Skip to content

Commit

Permalink
feat(toggle-button): add ToggleButton component
Browse files Browse the repository at this point in the history
  • Loading branch information
apust committed Jan 14, 2021
1 parent c43e89f commit 2df7ae6
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/packages/core/src/toggle-button/toggle-button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
._e_toggle-button {
display: flex;
}

._e_toggle-button__item {
display: flex;
align-items: center;
height: var(--S32);
padding-left: var(--S12);
padding-right: var(--S12);
font: var(--Body1);
color: var(--N600);
white-space: nowrap;
border-width: 1px 0 1px 1px;
border-style: solid;
border-color: var(--N50);
background-color: var(--N0);
cursor: pointer;

&:hover {
background-color: var(--N10);
}

&:first-child {
border-top-left-radius: var(--S4);
border-bottom-left-radius: var(--S4);
}

&:last-child {
border-top-right-radius: var(--S4);
border-bottom-right-radius: var(--S4);
border-width: 1px;
}
}

._e_toggle-button__item_selected {
border-color: var(--B100);
background-color: var(--B50);
color: var(--B400);

&:hover {
background-color: var(--B100);
}

& + ._e_toggle-button__item {
border-left-color: var(--B100);
}
}
11 changes: 11 additions & 0 deletions src/packages/core/src/toggle-button/toggle-button.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="_e_toggle-button">
<div class="_e_toggle-button__item _e_toggle-button__item_selected">Item 0</div>
<div class="_e_toggle-button__item">Item 1</div>
<div class="_e_toggle-button__item _e_toggle-button__item_selected">Item 2</div>
<div class="_e_toggle-button__item _e_toggle-button__item_selected">Item 3</div>
<div class="_e_toggle-button__item">Item 4</div>
<div class="_e_toggle-button__item">Item 5</div>
<div class="_e_toggle-button__item _e_toggle-button__item_selected">Item 6</div>
<div class="_e_toggle-button__item">Item 7</div>
<div class="_e_toggle-button__item _e_toggle-button__item_selected">Item 8</div>
</div>
14 changes: 14 additions & 0 deletions src/packages/core/src/toggle-button/toggle-button.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Meta, Preview, Story } from '@storybook/addon-docs/blocks';
import pretty from 'pretty';

import toggleButton from './toggle-button.html';

<Meta title='Core/ToggleButton' />

# ToggleButton

<Preview>
<Story name="default" height="160px" parameters={{ docs: { source: { code: pretty(toggleButton) } } }}>
{ () => toggleButton }
</Story>
</Preview>

0 comments on commit 2df7ae6

Please sign in to comment.