-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(toggle-button): add ToggleButton component
- Loading branch information
Showing
3 changed files
with
73 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,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); | ||
} | ||
} |
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,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
14
src/packages/core/src/toggle-button/toggle-button.stories.mdx
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,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> |