Skip to content

Commit

Permalink
feat(component-balloons): Dark Mode - Balloons
Browse files Browse the repository at this point in the history
Implementation so balloons can now have `is-dark`

re #345
  • Loading branch information
HiKaylum committed Oct 11, 2019
1 parent 77877e2 commit 18e6c47
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 21 deletions.
83 changes: 65 additions & 18 deletions scss/elements/balloons.scss
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -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 {
Expand All @@ -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);
}
}

Expand All @@ -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);
}
}
}
8 changes: 5 additions & 3 deletions story/balloons.stories.js
Original file line number Diff line number Diff line change
@@ -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>`;
});

0 comments on commit 18e6c47

Please sign in to comment.