Browse Source

adds code samples to all ui currently defined

pull/13/head
Jack Lukic 11 years ago
parent
commit
f344462f2f
4 changed files with 501 additions and 393 deletions
  1. 311
      docs/button.html
  2. 509
      docs/form.html
  3. 47
      docs/javascript/semantic.js
  4. 27
      docs/stylesheets/example.css

311
docs/button.html

@ -19,6 +19,7 @@
<link rel="stylesheet" href="stylesheets/example.css" type="text/css" media="screen" />
<script src="library/jquery.js" type="text/javascript"></script>
<script src="library/ace/ace.js" type="text/javascript"></script>
<script src="../src/modules/ui/shape.js" type="text/javascript"></script>
<script src="../src/modules/behavior/state.js" type="text/javascript"></script>
@ -138,182 +139,232 @@
</div>
</div>
<h2>Standard</h2>
<h4>Button:</h4>
<div class="ui button">Button</div>
<div class="example">
<h4>Button:</h4>
<p>A standard button</p>
<div class="ui button">Button</div>
</div>
<h2>States</h2>
<div class="example">
<h4>Hover</h4>
<p>Changes when a user moves their cursor over it</p>
<div class="ui hover button">Hovered Button</div>
</div>
<div class="example">
<h4>Down</h4>
<p>Changes when pressed using touch or mouse events</p>
<div class="ui down button">Pressed Button</div>
</div>
<div class="example">
<h4>Active</h4>
<p>Changes to show it is currently the selected user action</p>
<div class="ui active button">Active Button</div>
</div>
<div class="example">
<h4>Disabled</h4>
<p>Changes to show it is currently unable to be interacted with</p>
<div class="ui disabled button">Disabled Button</div>
</div>
<div class="example">
<h4>Loading</h4>
<p>Can show a loading indicator:</p>
<div class="ui loading button">Loading Button</div>
</div>
<div class="example">
<h4>Success</h4>
<p>Can alert to a succesful action:</p>
<div class="ui success button">Successful Button</div>
</div>
<div class="example">
<h4>Error</h4>
<p>Can alert user of an error:</p>
<div class="ui error button">Error</div>
<h4>All together:</h4>
<div class="ui button">Normal</div>
<div class="ui button hover">Hover</div>
<div class="ui button down">Down</div>
<div class="ui button loading">Loading</div>
<br><br>
<div class="ui button disabled">Disabled</div>
<div class="ui button active">Active</div>
<div class="ui button active toggle">Toggled</div>
<div class="ui button error">Error</div>
<div class="ui button success">Success</div>
<h2>Variations</h2>
<h4>Sizes</h4>
<p>Can have different sizes:</p>
<div class="mini ui button">
Mini
</div>
<div class="tiny ui button">
Tiny
</div>
<div class="small ui button">
Small
<div class="example">
<h4>All together:</h4>
<div class="ui button">Normal</div>
<div class="ui button hover">Hover</div>
<div class="ui button down">Down</div>
<div class="ui button loading">Loading</div>
<br><br>
<div class="ui button disabled">Disabled</div>
<div class="ui button active">Active</div>
<div class="ui button active toggle">Toggled</div>
<div class="ui button error">Error</div>
<div class="ui button success">Success</div>
</div>
<div class="medium ui button">
Medium
<h2>Variations</h2>
<div class="example">
<h4>Sizes</h4>
<p>Can have different sizes:</p>
<div class="mini ui button">
Mini
</div>
<div class="tiny ui button">
Tiny
</div>
<div class="small ui button">
Small
</div>
<div class="medium ui button">
Medium
</div>
<div class="large ui button">
Large
</div>
<div class="big ui button">
Big
</div>
<div class="huge ui button">
Huge
</div>
<div class="massive ui button">
Massive
</div>
<div class="gigantic ui button">
Gigantic
</div>
</div>
<div class="large ui button">
Large
<div class="example">
<h4>Colors</h4>
<p>Can have different colors:</p>
<div class="blue ui button">Blue Button</div>
<div class="purple ui button">Purple Button</div>
</div>
<div class="big ui button">
Big
<h4>Feedback</h4>
<div class="example">
<p>Can be positive or negative:</p>
<div class="positive ui button">Positive Button</div>
<div class="negative ui button">Negative Button</div>
</div>
<div class="huge ui button">
Huge
<div class="example">
<h4>Fluid</h4>
<p>Can fit parent container:</p>
<div class="fluid ui button">Fits container</div>
</div>
<div class="massive ui button">
Massive
<div class="example">
<h4>Bubbly</h4>
<p>Can be bubbly:</p>
<div class="bubbly ui button">More bubbly</div>
</div>
<div class="gigantic ui button">
Gigantic
<div class="example">
<h4>Icon</h4>
<p>Can be formatted as an icon toolbar:</p>
<div class="massive icon ui button">
<i class="icon cloud"></i>
</div>
</div>
<h4>Colors</h4>
<p>Can have different colors:</p>
<div class="blue ui button">Blue Button</div>
<div class="purple ui button">Purple Button</div>
<p>Can be positive or negative:</p>
<div class="positive ui button">Positive Button</div>
<div class="negative ui button">Negative Button</div>
<h4>Fluid</h4>
<p>Can fit parent container:</p>
<div class="fluid ui button">Fits container</div>
<h4>Bubbly</h4>
<p>Can be bubbly:</p>
<div class="bubbly ui button">More bubbly</div>
<h4>Icon</h4>
<p>Can be formatted as an icon toolbar:</p>
<div class="massive icon ui button">
<i class="icon cloud"></i>
<div class="example">
<h4>Vertically Attached</h4>
<p>Can be attached to the top or bottom of other content</p>
<div class="ui top attached button">Top</div>
<div style="border-left: 1px solid #DDDDDD;border-right: 1px solid #DDDDDD;background-color:#FFFFFF;height:200px;"></div>
<div class="ui bottom attached button">Bottom</div>
</div>
<h4>Attached</h4>
<p>Can be attached to the top or bottom of other content</p>
<div class="ui top attached button">Top</div>
<div style="border-left: 1px solid #DDDDDD;border-right: 1px solid #DDDDDD;background-color:#FFFFFF;height:200px;"></div>
<div class="ui bottom attached button">Bottom</div>
<br><br>
<p>Can be attached to the left or right of other content</p>
<div class="ui left attached button">Left</div>
<div style="width: 200px; display: inline-block; background-color: rgb(255, 255, 255); vertical-align: middle; height: 34px; margin: 0px -4px; border-bottom: 2px solid rgb(221, 221, 221); border-top: 2px solid rgb(221, 221, 221);"></div>
<div class="ui right attached button">Right</div>
<div class="example">
<h4>Horizontally Attached</h4>
<p>Can be attached to the left or right of other content</p>
<div class="ui left attached button">Left</div>
<div style="width: 200px; display: inline-block; background-color: rgb(255, 255, 255); vertical-align: middle; height: 34px; margin: 0px -4px; border-bottom: 2px solid rgb(221, 221, 221); border-top: 2px solid rgb(221, 221, 221);"></div>
<div class="ui right attached button">Right</div>
</div>
<br><br>
<p>Can be attached to an input field</p>
<div class="ui form">
<input type="text" class="attached">
<div class="ui attached button">Search</div>
</div>
<div class="example">
<h4>Form Attached</h4>
<p>Can be attached to an input field</p>
<div class="ui form">
<input type="text" class="attached">
<div class="ui attached button">Search</div>
</div>
</div>
<h2>Group</h2>
<h4>Buttons</h4>
<p>Can exist together as groups</p>
<div class="ui buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
</div>
<h4>Conditionals</h4>
<p>Groups can be separated by conditionals</p>
<div class="ui buttons">
<div class="ui button">Cancel</div>
<div class="or"></div>
<div class="ui positive button">Save</div>
<div class="example">
<h4>Buttons</h4>
<p>Can exist together as groups</p>
<div class="ui buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
</div>
</div>
<div class="example">
<h4>Conditionals</h4>
<p>Groups can be separated by conditionals</p>
<div class="ui buttons">
<div class="ui button">Cancel</div>
<div class="or"></div>
<div class="ui positive button">Save</div>
</div>
</div>
<h3>Plural Variations</h3>
<p>Singular variations can be applied to groups to infer all elements share the same quality</p>
<h4>Icon</h4>
<p>Groups can be formatted as icon toolbars</p>
<div class="ui icon buttons">
<div class="ui button"><i class="icon pause"></i></div>
<div class="ui button"><i class="icon play"></i></div>
<div class="ui button"><i class="icon fast-fw"></i></div>
<div class="example">
<h4>Icon</h4>
<p>Groups can be formatted as icon toolbars</p>
<div class="ui icon buttons">
<div class="ui button"><i class="icon pause"></i></div>
<div class="ui button"><i class="icon play"></i></div>
<div class="ui button"><i class="icon fast-fw"></i></div>
</div>
</div>
<h4>Fluid</h4>
<p>Groups can be divided evenly to fit parent</p>
<div class="ui five fluid buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
<div class="ui button">Four</div>
<div class="ui button">Five</div>
<div class="example">
<h4>Fluid</h4>
<p>Groups can be divided evenly to fit parent</p>
<div class="ui five fluid buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
<div class="ui button">Four</div>
<div class="ui button">Five</div>
</div>
</div>
<h4>Colors</h4>
<p>Groups can have a shared color</p>
<div class="blue ui buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
<div class="example">
<h4>Colors</h4>
<p>Groups can have a shared color</p>
<div class="blue ui buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
</div>
<div class="blue large icon ui buttons">
</div>
<div class="blue large icon ui buttons">
</div>
<h4>Sizes</h4>
<p>Groups can have a shared size</p>
<div class="huge ui buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
<div class="example"></div>
<h4>Sizes</h4>
<p>Groups can have a shared size</p>
<div class="huge ui buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
</div>
</div>
</div>

509
docs/form.html

@ -149,43 +149,41 @@
<h2>Standard</h2>
<div class="example">
<i class="icon code"></i>
<h4>Form:</h4>
<p>A form is a collection of user input elements, and has no stylings of its own.</p>
<div class="demo"><div class="ui form segment">
<p>Let's go ahead and get you signed up.</p>
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
<div class="field">
<label>Username</label>
<input placeholder="Username" type="text">
</div>
<div class="field">
<label>Password</label>
<input type="password">
</div>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" id="terms" />
<label for="terms"></label>
<div class="ui form segment">
<p>Let's go ahead and get you signed up.</p>
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
<div class="field">
<label>Username</label>
<input placeholder="Username" type="text">
</div>
<div class="field">
<label>Password</label>
<input type="password">
</div>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" id="terms" />
<label for="terms"></label>
</div>
<label>I agree to the terms and conditions</label>
</div>
<div class="ui blue submit button">Submit</div>
</div>
<label>I agree to the terms and conditions</label>
</div>
<div class="ui blue submit button">Submit</div>
</div></div>
</div>
<h3>Types of Content</h3>
<div class="example">
<i class="icon code"></i>
<h4>Field</h4>
<p>A field is a form element containing a label and an input</p>
<div class="ui form">
@ -194,44 +192,51 @@
<input type="text">
</div>
</div>
<h4>Text Area</h4>
<p>A textarea uses the default form element</p>
<div class="ui form">
<div class="field">
<label>User Text</label>
<textarea></textarea>
</div>
<div class="example">
<h4>Text Area</h4>
<p>A textarea uses the default form element</p>
<div class="ui form">
<div class="field">
<label>User Text</label>
<textarea></textarea>
</div>
</div>
</div>
<h4>Checkbox</h4>
<p>Checkboxes are styled forms of standard form checkboxes.</p>
<div class="ui form">
<div class="field">
<label>Checkbox (Using attribute ID to trigger checked event)</label>
<div class="ui checkbox">
<input type="checkbox" id="uniqueid" />
<label for="uniqueid"></label>
<div class="example">
<h4>Checkbox</h4>
<p>Checkboxes are styled forms of standard form checkboxes.</p>
<div class="ui form">
<div class="field">
<label>Checkbox (Using attribute ID to trigger checked event)</label>
<div class="ui checkbox">
<input type="checkbox" id="uniqueid" />
<label for="uniqueid"></label>
</div>
</div>
</div>
<div class="field">
<label>Checkbox (<a href="#">Javascript</a>)</label>
<div class="ui checkbox">
<input type="checkbox"/>
<label></label>
<div class="field">
<label>Checkbox (<a href="#">Javascript</a>)</label>
<div class="ui checkbox">
<input type="checkbox"/>
<label></label>
</div>
</div>
</div>
</div>
<h4>Validation</h4>
<p>Text blocks have special meaning inside a form tag. All message blocks are hidden by default.</p>
<div class="ui form">
<div class="ui block">
<div class="header">We had some issues</div>
<ul class="list">
<li>Please enter your first name</li>
<li>Please enter your last name</li>
</ul>
<div class="example">
<h4>Validation</h4>
<p>Text blocks have special meaning inside a form tag. All message blocks are hidden by default.</p>
<div class="ui form">
<div class="ui block">
<div class="header">We had some issues</div>
<ul class="list">
<li>Please enter your first name</li>
<li>Please enter your last name</li>
</ul>
</div>
</div>
</div>
@ -239,142 +244,152 @@
<h3>Form</h3>
<h4>Loading</h4>
<p>If a form is in loading state, it will automatically show a loading indicator:</p>
<div class="ui loading form segment">
<div class="two fields">
<div class="example">
<h4>Loading</h4>
<p>If a form is in loading state, it will automatically show a loading indicator:</p>
<div class="ui loading form segment">
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
<label>Username</label>
<input placeholder="Username" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
<label>Password</label>
<input type="password">
</div>
</div>
<div class="field">
<label>Username</label>
<input placeholder="Username" type="text">
</div>
<div class="field">
<label>Password</label>
<input type="password">
</div>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" id="terms" />
<label for="terms"></label>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" id="terms" />
<label for="terms"></label>
</div>
<label>I agree to the terms and conditions</label>
</div>
<label>I agree to the terms and conditions</label>
<div class="ui blue submit button">Submit</div>
</div>
<div class="ui blue submit button">Submit</div>
</div>
<h4>Error</h4>
<p>If form is in an error state, it will automatically show any error message blocks:</p>
<div class="ui error form segment">
<div class="ui error block">
<div class="header">Action Forbidden</div>
<p>You can only sign up for an account once with a given e-mail address.</p>
</div>
<div class="two fields">
<div class="example">
<h4>Error</h4>
<p>If form is in an error state, it will automatically show any error message blocks:</p>
<div class="ui error form segment">
<div class="ui error block">
<div class="header">Action Forbidden</div>
<p>You can only sign up for an account once with a given e-mail address.</p>
</div>
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
<label>Username</label>
<input placeholder="Username" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
<label>Password</label>
<input type="password">
</div>
</div>
<div class="field">
<label>Username</label>
<input placeholder="Username" type="text">
</div>
<div class="field">
<label>Password</label>
<input type="password">
</div>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" id="terms" />
<label for="terms"></label>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" id="terms" />
<label for="terms"></label>
</div>
<label>I agree to the terms and conditions</label>
</div>
<label>I agree to the terms and conditions</label>
<div class="ui blue submit button">Submit</div>
</div>
<div class="ui blue submit button">Submit</div>
</div>
<h4>Warning</h4>
<p>If form is in warning state, it will automatically show any warning message block:</p>
<div class="ui warning form segment">
<div class="ui warning block">
<div class="header">Could you check something!</div>
<ul class="list">
<li>You forgot your <b>first name</b></li>
<li>And also your <b>last name</b></li>
</ul>
</div>
<div class="two error fields">
<div class="example">
<h4>Warning</h4>
<p>If form is in warning state, it will automatically show any warning message block:</p>
<div class="ui warning form segment">
<div class="ui warning block">
<div class="header">Could you check something!</div>
<ul class="list">
<li>You forgot your <b>first name</b></li>
<li>And also your <b>last name</b></li>
</ul>
</div>
<div class="two error fields">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
<label>Username</label>
<input placeholder="Username" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
<label>Password</label>
<input type="password">
</div>
</div>
<div class="field">
<label>Username</label>
<input placeholder="Username" type="text">
</div>
<div class="field">
<label>Password</label>
<input type="password">
</div>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" id="terms" />
<label for="terms"></label>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" id="terms" />
<label for="terms"></label>
</div>
<label>I agree to the terms and conditions</label>
</div>
<label>I agree to the terms and conditions</label>
<div class="ui blue submit button">Submit</div>
</div>
<div class="ui blue submit button">Submit</div>
</div>
<h3>Form Fields</h3>
<h4>Error</h4>
<p>Individual fields may contain an error state</p>
<div class="ui error form segment">
<div class="two fields">
<div class="field error">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
<div class="example">
<h4>Error</h4>
<p>Individual fields may contain an error state</p>
<div class="ui error form segment">
<div class="two fields">
<div class="field error">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
</div>
</div>
<h4>Disabled</h4>
<p>Individual fields may be disabled or read only</p>
<div class="ui error form segment">
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="Read Only" readonly="readonly" type="text">
</div>
<div class="disabled field">
<label>Last Name</label>
<input placeholder="Disabled" disabled="disabled" type="text">
<div class="example">
<h4>Disabled</h4>
<p>Individual fields may be disabled or read only</p>
<div class="ui error form segment">
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="Read Only" readonly="readonly" type="text">
</div>
<div class="disabled field">
<label>Last Name</label>
<input placeholder="Disabled" disabled="disabled" type="text">
</div>
</div>
</div>
</div>
@ -383,64 +398,26 @@
<h3>Forms</h3>
<h4>Size</h4>
<p>A form can also be small or large</p>
<div class="ui small form segment">
<div class="ui info block">
<div class="header">We had some issues</div>
<ul class="list">
<li>Please enter your first name</li>
<li>Please enter your last name</li>
</ul>
</div>
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
<div class="ui blue small submit button">Submit</div>
</div>
<br><br>
<div class="ui large form segment">
<div class="ui info block">
<div class="header">We had some issues</div>
<ul class="list">
<li>Please enter your first name</li>
<li>Please enter your last name</li>
</ul>
</div>
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
<div class="example">
<h4>Size</h4>
<p>A form can also be small or large</p>
<div class="ui small form segment">
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
<div class="ui blue small submit button">Submit</div>
</div>
<div class="ui blue submit button">Submit</div>
</div>
<h4>Inverted</h4>
<p>A form on a dark background may have to invert its color scheme</p>
<div style="background-color: #333333; padding: 15px;">
<div class="ui inverted form">
<div class="ui info block">
<div class="header">We had some issues</div>
<ul class="list">
<li>Please enter your first name</li>
<li>Please enter your last name</li>
</ul>
</div>
<br><br>
<div class="ui large form segment">
<div class="two fields">
<div class="error field">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
@ -453,47 +430,81 @@
</div>
</div>
<div class="example">
<h4>Inverted</h4>
<p>A form on a dark background may have to invert its color scheme</p>
<div style="background-color: #333333; padding: 15px;">
<div class="ui inverted form">
<div class="ui info block">
<div class="header">We had some issues</div>
<ul class="list">
<li>Please enter your first name</li>
<li>Please enter your last name</li>
</ul>
</div>
<div class="two fields">
<div class="error field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
<div class="ui blue submit button">Submit</div>
</div>
</div>
</div>
<h3>Fields</h3>
<h4>Inline</h4>
<p>A field can have its label next to instead of above it.</p>
<div class="ui form">
<div class="ui inline fields">
<div class="field">
<label>Last name</label>
<input type="text" placeholder="Full Name">
<div class="example">
<h4>Inline</h4>
<p>A field can have its label next to instead of above it.</p>
<div class="ui form">
<div class="ui inline fields">
<div class="field">
<label>Last name</label>
<input type="text" placeholder="Full Name">
</div>
</div>
</div>
</div>
<h4>Date</h4>
<p>A field can let users know they are for dates</p>
<div class="ui form">
<div class="date field">
<label>Birthday</label>
<input type="text" placeholder="Full Name">
<div class="example">
<h4>Date</h4>
<p>A field can let users know they are for dates</p>
<div class="ui form">
<div class="date field">
<label>Birthday</label>
<input type="text" placeholder="Full Name">
</div>
</div>
</div>
<h2>Groups</h2>
<h4>Field Groups</h4>
<p>Fields can exist side by side to show relation</p>
<div class="ui form">
<div class="ui three fields">
<div class="field">
<label>First name</label>
<input type="text" placeholder="First Name">
</div>
<div class="field">
<label>Middle name</label>
<input type="text" placeholder="Middle Name">
</div>
<div class="field">
<label>Last name</label>
<input type="text" placeholder="Last Name">
<div class="example">
<h4>Field Groups</h4>
<p>Fields can exist side by side to show relation</p>
<div class="ui form">
<div class="ui three fields">
<div class="field">
<label>First name</label>
<input type="text" placeholder="First Name">
</div>
<div class="field">
<label>Middle name</label>
<input type="text" placeholder="Middle Name">
</div>
<div class="field">
<label>Last name</label>
<input type="text" placeholder="Last Name">
</div>
</div>
</div>
</div>

47
docs/javascript/semantic.js

@ -14,7 +14,7 @@ semantic.ready = function() {
$demo = $('.demo'),
$waypoints = $('h2'),
$exampleCode = $('.example i.code'),
$example = $('.example'),
$peek = $('.peek'),
$peekMenu = $peek.find('li'),
@ -27,14 +27,26 @@ semantic.ready = function() {
// event handlers
handler = {
createIcon: function() {
$example
.each(function(){
$('<i/>')
.addClass('icon code')
.prependTo( $(this) )
;
})
;
},
createCode: function() {
var
$example = $(this).closest('.example'),
$shape = $example.find('.shape.module'),
$demo = $example.find('.demo'),
$demo = $example.children().slice(2).not('.annotated'),
$annotated = $example.find('.annotated'),
$code = $annotated.find('.code'),
code = $demo.get(0).innerHTML
whiteSpace = new RegExp('\\n\\s{4}', 'g'),
code = ''
;
// add source if doesnt exist and initialize
if($annotated.size() === 0) {
@ -44,8 +56,14 @@ semantic.ready = function() {
;
}
if( $code.size() === 0) {
code = code.replace('^(\s+)', '$1$1');
console.log(code);
$demo
.each(function(){
if($(this).hasClass('ui')) {
code += $(this).get(0).outerHTML + "\n";
}
})
;
code = $.trim(code.replace(whiteSpace, '\n'));
$code = $('<div/>')
.data('type', 'html')
.addClass('code')
@ -54,13 +72,18 @@ semantic.ready = function() {
;
$.proxy(handler.initializeCode, $code)();
}
if( $demo.is(':visible') ) {
if( $demo.first().is(':visible') ) {
$demo.hide();
$annotated.fadeIn(500);
}
else {
$annotated.hide();
$demo.fadeIn(500);
if($demo.size() > 1) {
$demo.show();
}
else {
$demo.fadeIn(500);
}
}
},
@ -74,8 +97,8 @@ semantic.ready = function() {
contentType = $code.data('type') || 'javascript',
editor = ace.edit($code[0]),
editorSession = editor.getSession(),
padding = 0,
codeHeight = editor.getSession().getScreenLength() * (editor.renderer.lineHeight + padding) + editor.renderer.scrollBar.getWidth()
padding = 4,
codeHeight = editor.getSession().getScreenLength() * (editor.renderer.lineHeight) + editor.renderer.scrollBar.getWidth() + padding
;
editor.setTheme('ace/theme/github');
editor.setShowPrintMargin(false);
@ -157,8 +180,10 @@ semantic.ready = function() {
;
}
$exampleCode
.on('click', handler.createCode)
handler.createIcon();
$example
.find('i.code')
.on('click', handler.createCode)
;
$swap

27
docs/stylesheets/example.css

@ -278,13 +278,34 @@ a:hover {
background-color: rgba(0, 0, 0, 0.05);
border: 1px solid rgba(0, 0, 0, 0.1);
}
#example div.code .ace_line {
color: #555555;
}
#example div.code .ace_tag {
color: #7F6277;
}
#example div.code .ace_indent-guide {
position: relative;
background: none;
}
#example div.code .ace_indent-guide:after {
content: '';
position: absolute;
top: 0px;
right: 0px;
height: 100%;
border-left: 1px solid #ECF5F3;
}
#example div.code .ace_attribute-name {
color: #934E4E;
}
#example div.code .ace_scroller {
margin: 14px 10px;
}
#example div.code .ace_content {
}
#example div.code .ace_string {
color: #e82d2d;
color: #00A59D;
}
#example div.code .ace_cursor {
border-left: 1px solid #AAAAAA;
@ -296,7 +317,7 @@ a:hover {
color: #555555;
}
#example div.code .ace_identifier {
color: #247992;
color: #555555;
}
#example div.code .ace_scrollbar {
overflow: hidden;
@ -332,7 +353,7 @@ a:hover {
width: auto;
overflow: visible;
opacity: 0.5;
top: 5px;
top: 0px;
right: 5px;
}
#example .example:hover i.code:hover {

Loading…
Cancel
Save