Skip to content

Commit a55effc

Browse files
Merge pull request #28 from treehouse/label-wrap
Improving form elements
2 parents 0642543 + eb5099f commit a55effc

File tree

8 files changed

+86
-13
lines changed

8 files changed

+86
-13
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Leap is an internal CSS library made for Treehouse. It contains immutable utilit
44
## Quick Start
55
Several options are available for installing Leap into your project.
66

7-
* [Download the latest release](https://github.com/treehouse/project-leap/archive/v0.8.9.zip)
7+
* [Download the latest release](https://github.com/treehouse/project-leap/archive/v0.9.0.zip)
8+
89
* Clone the repo: `git clone https://github.com/treehouse/project-leap.git`
910
* Install with [Bower](http://bower.io)
1011

_includes/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</div>
88

99
<footer class="guide-contentinfo" role="contentinfo">
10-
<p class="guide-contentinfo-copy">Copyright &copy; 2016 Treehouse. All rights reserved.</p>
10+
<p class="guide-contentinfo-copy">Copyright &copy; 2018 Treehouse. All rights reserved.</p>
1111
</footer>
1212

1313
<script src="js/prism.js"></script>

_sass/leap/_variables.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$leap-version: "0.8.9";
1+
$leap-version: "0.9.0";
22

33
// Brand Colors
44
$brand-colors: (

_sass/leap/atoms/_button.sass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136

137137
// Inline buttons next to input fields
138138
&--inline
139-
margin-top: 24px !important
139+
margin-top: 28px !important
140140
padding: 0 26px !important
141141
height: 47px !important
142142
line-height: 43px !important

_sass/leap/atoms/_forms.sass

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,15 @@ $form-states: success, warning, error
128128
.ff &
129129
padding: .688rem 1rem
130130
padding-right: 2rem
131+
// Adding in focus & hover states
131132
&:focus
132133
background-color: $form-background-active
133134
border: 2px solid $form-border-active
135+
&:hover
136+
background-color: $form-background-active
137+
border: 2px solid $form-border-active
138+
color: $form-color-active
139+
134140

135141
// Radio & Checkboxes
136142
&-radio,
@@ -147,6 +153,7 @@ $form-states: success, warning, error
147153
font-weight: normal
148154
color: $form-color-inactive
149155
padding: .25rem 0
156+
margin-left: 25px !important
150157
// Building stylized elements to replace defaults
151158
&:before
152159
content: ''
@@ -169,14 +176,25 @@ $form-states: success, warning, error
169176
color: $form-color-active
170177
&:before
171178
border: 2px solid $form-border-active
179+
// Hover states for radio and checkboxes
180+
&:hover+.form-label
181+
&:before
182+
border: 2px solid $form-border-active
183+
cursor: pointer
184+
// Making the hover state stand out on forms over dark backgrounds
185+
&:hover+.text-color-white, &:focus+.text-color-white
186+
&:before
187+
border: 2px solid #fff
172188
// Default Radio Styles
173189
&-radio
174190
&+.form-label:before
175191
border-radius: 50%
176-
border: 1px solid $border-color-mid
192+
border: 2px solid $border-color-mid
193+
margin-left: -25px
177194
// Selected Radio Styles
178195
&:checked+.form-label:before
179196
border: 5px solid ui-color(blue)
197+
background-color: #fff
180198
// Default Checkbox Styles
181199
&-checkbox
182200
&+.form-label:before
@@ -185,8 +203,9 @@ $form-states: success, warning, error
185203
width: 1rem
186204
height: 1rem
187205
border-radius: $border-radius
188-
border: 1px solid $border-color-mid
189-
// Slected Checkbox Styles
206+
border: 2px solid $border-color-mid
207+
margin-left: -25px !important
208+
// Selected Checkbox Styles
190209
&:checked+.form-label:before
191210
border: none
192211
background-color: ui-color(blue)

forms.html

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@ <h2 id="Radios" class="m-b-1-xs">Radios</h2>
114114
<p class="m-b-1-xs">Use <code>.form-radio</code> immediately following a <code>label</code> to get Leap's default radio button style.</p>
115115

116116
<form class="m-b-2-xs">
117-
<input type="radio" id="form-radio-1" class="form-radio" name="radio">
118-
<label for="form-radio-1" class="form-label">Radio Label 1</label>
117+
<input type="radio" id="form-radio-1" class="form-radio" name="radio" checked="checked">
118+
<label for="form-radio-1" class="form-label">A really long radio label that goes on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on.</label>
119119

120120
<input type="radio" id="form-radio-2" class="form-radio" name="radio">
121-
<label for="form-radio-2" class="form-label">Radio Label 2</label>
121+
<label for="form-radio-2" class="form-label">A short radio label.</label>
122122
</form>
123+
123124
<div class="guide-code m-b-4-xs">
124125
<pre><code class="language-html">&lt;form&gt;
125126
&lt;input type="radio" id="form-radio-1" class="form-radio" name="radio" checked="checked"&gt;
@@ -129,18 +130,37 @@ <h2 id="Radios" class="m-b-1-xs">Radios</h2>
129130
&lt;/form&gt;</code></pre>
130131
</div>
131132

133+
<p class="m-b-1-xs">Forms with white text on dark backgrounds have a lighter hover state. To enable this, <code>.text-color-white</code> must be a class alongside <code>.form-label</code>.</p>
134+
135+
<form class="p-2-xs m-b-2-xs bg-gray-darker round">
136+
<input type="radio" id="form-radio-3" class="form-radio" name="radio" checked="checked">
137+
<label for="form-radio-3" class="form-label text-color-white">A radio label on a dark background.</label>
138+
<input type="radio" id="form-radio-4" class="form-radio" name="radio">
139+
<label for="form-radio-4" class="form-label text-color-white m-b-0-xs">Another radio label on a dark background.</label>
140+
</form>
141+
142+
<div class="guide-code m-b-4-xs">
143+
<pre><code class="language-html">&lt;form class="p-2-xs m-b-2-xs bg-gray-darker round"&gt;
144+
&lt;input type="radio" id="form-radio-3" class="form-radio" name="radio" checked="checked"&gt;
145+
&lt;label for="form-radio-3" class="form-label text-color-white"&gt;A radio label on a dark background.&lt;/label&gt;
146+
&lt;input type="radio" id="form-radio-4" class="form-radio" name="radio"&gt;
147+
&lt;label for="form-radio-4" class="form-label text-color-white m-b-0-xs"&gt;Another radio label on a dark background.&lt;/label&gt;
148+
&lt;/form&gt;</code></pre>
149+
</div>
150+
132151

133152
<!-- Checkboxes -->
134153
<h2 id="Checkboxes" class="m-b-1-xs">Checkboxes</h2>
135154
<p class="m-b-1-xs">Use <code>.form-checkbox</code> immediately following a <code>label</code> to get Leap's default checkbox style.</p>
136155

137156
<form class="m-b-2-xs">
138157
<input type="checkbox" id="form-checkbox-1" class="form-checkbox">
139-
<label for="form-checkbox-1" class="form-label">Checkbox Label 1</label>
158+
<label for="form-checkbox-1" class="form-label">A really long checkbox label that goes on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on.</label>
140159

141160
<input type="checkbox" id="form-checkbox-2" class="form-checkbox">
142-
<label for="form-checkbox-2" class="form-label">Checkbox Label 2</label>
161+
<label for="form-checkbox-2" class="form-label">A short checkbox label.</label>
143162
</form>
163+
144164
<div class="guide-code m-b-4-xs">
145165
<pre><code class="language-html">&lt;form&gt;
146166
&lt;input type="checkbox" id="form-checkbox-1" class="form-checkbox"&gt;
@@ -150,6 +170,23 @@ <h2 id="Checkboxes" class="m-b-1-xs">Checkboxes</h2>
150170
&lt;/form&gt;</code></pre>
151171
</div>
152172

173+
<p class="m-b-1-xs">Forms with white text on dark backgrounds have a lighter hover state. To enable this, <code>.text-color-white</code> must be a class alongside <code>.form-label</code>.</p>
174+
175+
<form class="p-2-xs m-b-2-xs bg-gray-darker round">
176+
<input type="checkbox" id="form-checkbox-3" class="form-checkbox">
177+
<label for="form-checkbox-3" class="form-label text-color-white">A checkbox label on a dark background.</label>
178+
<input type="checkbox" id="form-checkbox-4" class="form-checkbox">
179+
<label for="form-checkbox-4" class="form-label text-color-white m-b-0-xs">Another checkbox label on a dark background.</label>
180+
</form>
181+
182+
<div class="guide-code m-b-4-xs">
183+
<pre><code class="language-html">&lt;form class="p-2-xs m-b-2-xs bg-gray-darker round"&gt;
184+
&lt;input type="checkbox" id="form-checkbox-3" class="form-checkbox"&gt;
185+
&lt;label for="form-checkbox-3" class="form-label text-color-white"&gt;A checkbox label on a dark background.&lt;/label&gt;
186+
&lt;input type="checkbox" id="form-checkbox-4" class="form-checkbox"&gt;
187+
&lt;label for="form-checkbox-4" class="form-label text-color-white m-b-0-xs"&gt;Another checkbox label on a dark background.&lt;/label&gt;
188+
&lt;/form&gt;</code></pre>
189+
</div>
153190

154191
<!-- Uploads -->
155192
<h2 id="Uploads" class="m-b-1-xs">Uploads</h2>

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h2 class="m-b-1-xs">Installation</h2>
3434
<p class="m-b-4-xs">In your project directory: <code>bower install leap --save</code></p>
3535

3636
<h2 class="m-b-1-xs">Download</h2>
37-
<a href="https://github.com/treehouse/project-leap/archive/v0.8.9.zip" class="button button--large-xs w-full-xs w-auto-lg">Source Files</a>
37+
<a href="https://github.com/treehouse/project-leap/archive/v0.9.0.zip" class="button button--large-xs w-full-xs w-auto-lg">Source Files</a>
3838
<a href="http://treehouse.github.io/project-leap/css/leap.css" class="button button--large-xs w-full-xs w-auto-lg">Compiled CSS</a>
3939
<a href="http://treehouse.github.io/project-leap/css/leap.min.css" class="button button--large-xs w-full-xs w-auto-lg">Compiled CSS (minified)</a>
4040

release-notes.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,20 @@
264264
</ul>
265265
</div>
266266
</div>
267+
<div class="col-container border-b-xs p-b-2-xs m-t-2-xs">
268+
<div class="col col-10-md">
269+
<p class="text-color-light">0.9.0</p>
270+
</div>
271+
<div class="col col-90-md">
272+
<p class="bold">Improving Form Elements</p>
273+
<p class="text-6-xs text-color-light">April 18, 2018</p>
274+
<ul class="m-t-1-xs text-6-xs">
275+
<li>Added support for radio and checkbox labels that wrap into multiple lines; now the labels left align with the inputs.</li>
276+
<li>Explicitly made radio buttons have a white background color. This solves a readability issue that occured when a radio button was placed on a non-white background (the center was rendering as transparent).</li>
277+
<li>Added hover and focus states for radio, checkbox, and select inputs. Included an option for light forms on dark backgrounds.</li>
278+
<li>Thickened radio and checkbox borders from 1px to 2px to match other inputs and stand out more.</li>
279+
<li>Improved inline buttons so they are now aligned with input fields.</li>
280+
</ul>
281+
</div>
282+
</div>
267283
</section>

0 commit comments

Comments
 (0)