-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add checkbox primary * add hover states * use class name * Add transition: * disabled state * add class for no outline * add mixin for no-select * add radios * add focus states * remoev focus, too weird * remove no-outline * fix color conflicts * unify * clean up class names * split up stories
- Loading branch information
Celeste Glavin
authored and
Adam Raider
committed
Feb 27, 2019
1 parent
8ff572b
commit a96466d
Showing
6 changed files
with
132 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
packages/ray/lib/components/radio-checkbox/_radio-checkbox.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
$radio-checkbox-border-width: 3px; | ||
$radio-checkbox-width: 1rem; | ||
|
||
.#{$prefix}radio, | ||
.#{$prefix}checkbox { | ||
@include no-select; | ||
|
||
label { | ||
padding-left: 1rem; | ||
} | ||
|
||
&__input { | ||
appearance: none; | ||
background-color: $ray-color-white; | ||
border: $radio-checkbox-border-width double $ray-color-black; | ||
width: $radio-checkbox-width; | ||
height: $radio-checkbox-width; | ||
transform: translateY(16%); | ||
|
||
&::after { | ||
content: ''; | ||
width: calc(#{$radio-checkbox-width} - 2 * #{$radio-checkbox-border-width}); | ||
height: calc(#{$radio-checkbox-width} - 2 * #{$radio-checkbox-border-width}); | ||
background: $ray-color-white; | ||
display: block; | ||
transition: $transition; | ||
} | ||
|
||
&:checked { | ||
border-color: $ray-color-blue-50; | ||
|
||
&::after { | ||
background: $ray-color-blue-50; | ||
} | ||
|
||
&:hover { | ||
border-color: $ray-color-blue-70; | ||
|
||
&::after { | ||
background: $ray-color-blue-70; | ||
} | ||
} | ||
} | ||
|
||
&:not(:checked) { | ||
&:hover { | ||
&::after { | ||
background: $ray-color-blue-10; | ||
} | ||
} | ||
} | ||
|
||
&[disabled] { | ||
border-color: #B0B0B0; | ||
|
||
&:hover { | ||
&::after { | ||
background: $ray-color-white; | ||
} | ||
} | ||
|
||
+ label { | ||
cursor: not-allowed; | ||
color: #B0B0B0; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.#{$prefix}radio__input { | ||
border-radius: 50%; | ||
|
||
&::after { | ||
border-radius: 50%; | ||
} | ||
} | ||
|
||
.#{$prefix}checkbox__input { | ||
border-radius: $border-radius; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
|
||
import withPadding from './util/withPadding'; | ||
|
||
storiesOf('Forms - Radio buttons and Checkboxes', module) | ||
.addWithJSX('Radio button', () => | ||
withPadding( | ||
<React.Fragment> | ||
<div className="ray-radio"> | ||
<input id="radio-1" name="radio-button-story" type="radio" className="ray-radio__input" /> | ||
<label htmlFor="radio-1">Choose me</label> | ||
</div> | ||
<div className="ray-radio"> | ||
<input id="radio-2" name="radio-button-story" type="radio" className="ray-radio__input" /> | ||
<label htmlFor="radio-2">Choose me</label> | ||
</div> | ||
<div className="ray-radio"> | ||
<input id="radio-3" name="radio-button-story" type="radio" className="ray-radio__input" disabled /> | ||
<label htmlFor="radio-3">Choose me</label> | ||
</div> | ||
</React.Fragment> | ||
)) | ||
.addWithJSX('Checkbox', () => | ||
withPadding( | ||
<div className="ray-checkbox"> | ||
<input id="check" type="checkbox" className="ray-checkbox__input" /> | ||
<label htmlFor="check">Check me out</label> | ||
</div> | ||
) | ||
) | ||
.addWithJSX('Checkbox - disabled', () => | ||
withPadding( | ||
<div className="ray-checkbox"> | ||
<input id="check" type="checkbox" className="ray-checkbox__input" disabled /> | ||
<label htmlFor="check">Check me out</label> | ||
</div> | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters