-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(avatars): add avatar component (#156)
- Loading branch information
1 parent
73b3616
commit 3d41fb8
Showing
4 changed files
with
58 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies | ||
import { // eslint-disable-line import/no-extraneous-dependencies | ||
withKnobs, radios, boolean, | ||
} from '@storybook/addon-knobs'; | ||
|
||
const stories = storiesOf('Avatars', module); | ||
stories.addDecorator(withKnobs); | ||
|
||
stories.add('avatars', () => { | ||
const options = radios('class', { | ||
'is-small': 'is-small', | ||
default: '', | ||
'is-medium': 'is-medium', | ||
'is-large': 'is-large', | ||
}, ''); | ||
const isRounded = boolean('is-rounded', false) ? 'is-rounded' : ''; | ||
const selectedClasses = [isRounded, options].join(' '); | ||
|
||
return `<img src="http://www.gravatar.com/avatar" class="nes-avatar ${selectedClasses}">`; | ||
}); |
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 |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
@import "balloons.scss"; | ||
@import "tables.scss"; | ||
@import "progress.scss"; | ||
@import "avatar.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,23 @@ | ||
@mixin img-style($param) { | ||
$size: $param * 16; | ||
|
||
width: $size; | ||
height: $size; | ||
|
||
&.is-rounded { | ||
border-radius: 50px; | ||
} | ||
} | ||
.nes-avatar { | ||
@include img-style(2px); | ||
|
||
&.is-small { | ||
@include img-style(1px); | ||
} | ||
&.is-medium { | ||
@include img-style(3px); | ||
} | ||
&.is-large { | ||
@include img-style(4px); | ||
} | ||
} |