1
0
mirror of https://github.com/nostalgic-css/NES.css.git synced 2025-04-21 22:52:42 +02:00

Merge branch 'develop' into storybook_instructions

This commit is contained in:
B.C.Rikko 2019-10-16 14:05:46 +09:00 committed by GitHub
commit 5c959aae2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 21 deletions

View File

@ -39,6 +39,9 @@
"nes",
"framework"
],
"engines": {
"node": "10.x"
},
"author": "BcRikko (https://github.com/Bcrikko)",
"license": "MIT",
"bugs": {

View File

@ -1,3 +1,27 @@
@mixin box-shadow($color, $fromLeft: true) {
@if $fromLeft {
// prettier-ignore
box-shadow:
-4px 0,
4px 0,
-4px 4px $color,
0 4px,
-8px 4px,
-4px 8px,
-8px 8px;
} @else {
// prettier-ignore
box-shadow:
-4px 0,
4px 0,
4px 4px $color,
0 4px,
8px 4px,
4px 8px,
8px 8px;
}
}
.nes-balloon {
@include rounded-corners();
@ -18,6 +42,45 @@
content: "";
}
&.is-dark {
@include rounded-corners(true);
background: $base-color;
color: $background-color;
border-image-outset: 2;
box-shadow: 0px 0px 0 8px $base-color;
&.from-left,
&.from-right {
&::before {
background-color: $base-color;
border-color: $background-color;
}
&::after {
color: $background-color;
background-color: $base-color;
}
}
&.from-left {
&::before {
box-shadow: -5px 10px 0 6px $base-color;
}
&::after {
@include box-shadow($base-color);
}
}
&.from-right {
&::before {
box-shadow: 5px 10px 0 6px $base-color;
}
&::after {
@include box-shadow($base-color, false);
}
}
}
&.from-left {
&::before,
&::after {
@ -40,15 +103,7 @@
margin-right: 8px;
color: $base-color;
background-color: $background-color;
// prettier-ignore
box-shadow:
-4px 0,
4px 0,
-4px 4px $background-color,
0 4px,
-8px 4px,
-4px 8px,
-8px 8px;
@include box-shadow($background-color);
}
}
@ -73,15 +128,7 @@
height: 4px;
margin-left: 8px;
background-color: $background-color;
// prettier-ignore
box-shadow:
-4px 0,
4px 0,
4px 4px $background-color,
0 4px,
8px 4px,
4px 8px,
8px 8px;
@include box-shadow($background-color, false);
}
}
}

View File

@ -1,16 +1,18 @@
import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies
import { // eslint-disable-line import/no-extraneous-dependencies
withKnobs, radios,
withKnobs, boolean, radios,
} from '@storybook/addon-knobs';
const stories = storiesOf('Ballons', module);
stories.addDecorator(withKnobs);
stories.add('balloon', () => {
const selectedClass = radios('direction', {
const isDark = boolean('is-dark', false) ? 'is-dark' : '';
const alignment = radios('direction', {
default: '',
'from-left': 'from-left',
'from-right': 'from-right',
}, '');
return `<div class="nes-balloon ${selectedClass}"> <p>Hello NES.css</p> </div>`;
const selectedClasses = [isDark, alignment];
return `<div class="nes-balloon ${selectedClasses.join(' ')}"> <p>Hello NES.css</p> </div>`;
});