1
0
mirror of https://github.com/nostalgic-css/NES.css.git synced 2025-08-01 04:00:11 +02:00

feat(list): add list is-dark storybook and classes

This commit is contained in:
Igor Guastalla
2020-01-28 07:34:35 -03:00
parent 775027138a
commit 2316c07c3a
2 changed files with 29 additions and 16 deletions

View File

@@ -1,3 +1,18 @@
@mixin list-before(
$class,
$disc-or-circle,
$colors: ($base-color, map-get($default-colors, "shadow"))
) {
&.is-#{$class} li::before {
position: absolute;
top: calc(50% - 8px);
left: -22px;
content: "";
@include pixelize(2px, $disc-or-circle, $colors);
}
}
.nes-list { .nes-list {
// prettier-ignore // prettier-ignore
$disc: ( $disc: (
@@ -18,7 +33,6 @@
(0,0,1,1,1,1,0,0), (0,0,1,1,1,1,0,0),
(0,0,0,1,1,0,0,0) (0,0,0,1,1,0,0,0)
); );
$colors: ($base-color, map-get($default-colors, "shadow"));
list-style-type: none; list-style-type: none;
@@ -26,21 +40,16 @@
position: relative; position: relative;
} }
&.is-disc li::before { @include list-before("disc", $disc);
position: absolute; @include list-before("circle", $circle);
top: calc(50% - 8px);
left: -22px;
content: "";
@include pixelize(2px, $disc, $colors); &.is-dark {
} $dark-colors: ($background-color, $base-color);
@include list-before("disc", $disc, $dark-colors);
@include list-before("circle", $circle, $dark-colors);
&.is-circle li::before { li {
position: absolute; color: $color-white;
top: calc(50% - 8px); }
left: -22px;
content: "";
@include pixelize(2px, $circle, $colors);
} }
} }

View File

@@ -1,7 +1,8 @@
import { radios } from '@storybook/addon-knobs'; import { radios, boolean } from '@storybook/addon-knobs';
import classNames from 'classnames'; import classNames from 'classnames';
export default () => { export default () => {
const isDark = boolean('is-dark', false);
const listOptions = radios('List Type', { const listOptions = radios('List Type', {
'is-disc': 'is-disc', 'is-disc': 'is-disc',
'is-circle': 'is-circle', 'is-circle': 'is-circle',
@@ -9,6 +10,9 @@ export default () => {
const listClasses = classNames( const listClasses = classNames(
'nes-list', 'nes-list',
{
'is-dark': isDark,
},
listOptions, listOptions,
); );