-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
150 additions
and
2 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
packages/chlorophyll-storybook/src/stories/css/tabs-bar/TabsBar.stories.svelte
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,21 @@ | ||
<script> | ||
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"; | ||
import TabsBar from "./TabsBar.svelte"; | ||
</script> | ||
|
||
<Meta | ||
title="CSS/TabsBar/Stories" | ||
component={TabsBar} | ||
argTypes={{}} | ||
/> | ||
|
||
|
||
<Template let:args> | ||
<TabsBar {...args}/> | ||
</Template> | ||
|
||
<Story | ||
source={`<div></div>`} | ||
name="Default" | ||
args={{}} | ||
/> |
18 changes: 18 additions & 0 deletions
18
packages/chlorophyll-storybook/src/stories/css/tabs-bar/TabsBar.svelte
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,18 @@ | ||
<script> | ||
/** | ||
* Tabs make it easy to explore and switch between different views or functional aspects of an app or to browse categorized data sets. | ||
* @component | ||
*/ | ||
</script> | ||
|
||
<nav role="tablist"> | ||
<a href='#tab' aria-controls="tab-content-1" role="tab" aria-selected='true'>Tab 1</a> | ||
<a href='#tab' aria-controls="tab-content-2" role="tab">Tab 2</a> | ||
<a href='#tab' aria-controls="tab-content-3" role="tab">Tab 3</a> | ||
</nav> | ||
<section aria-live="polite"> | ||
<article id="tab-content-1" role="tabpanel" aria-hidden='false'>Content for tab 1</article> | ||
<article id="tab-content-2" role="tabpanel" aria-hidden='true'>Content for tab 2</article> | ||
<article id="tab-content-3" role="tabpanel" aria-hidden='true'>Content for tab 3</article> | ||
</section> |
11 changes: 11 additions & 0 deletions
11
packages/chlorophyll-storybook/src/stories/css/tabs-bar/index.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,11 @@ | ||
import { Meta, Story } from '@storybook/addon-docs/blocks'; | ||
|
||
<Meta title="CSS/TabsBar/Overview" /> | ||
|
||
# Tabs bar | ||
|
||
Tabs make it easy to explore and switch between different views or functional aspects of an app or to browse categorized data sets. | ||
|
||
<Canvas> | ||
<Story id="css-tabsbar-stories--default" /> | ||
</Canvas> |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
@use 'button'; | ||
@use 'input'; | ||
@use 'link'; | ||
@use 'tabs-bar'; | ||
@use 'utility/spacing'; | ||
@use 'typography'; | ||
|
||
|
21 changes: 21 additions & 0 deletions
21
packages/chlorophyll/src/scss/classes/tabs-bar/_index.scss
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,21 @@ | ||
@use '../../mixins/tabs-bar'; | ||
|
||
#{tabs-bar.$selector-tab} { | ||
@include tabs-bar.tab; | ||
} | ||
|
||
#{tabs-bar.$selector-tab--selected} { | ||
@include tabs-bar.tab--selected; | ||
} | ||
|
||
#{tabs-bar.$selector-tabs-bar} { | ||
@include tabs-bar.tabs-bar | ||
} | ||
|
||
#{tabs-bar.$selector-tab-panel} { | ||
@include tabs-bar.tabs-panel; | ||
} | ||
|
||
#{tabs-bar.$selector-tab-panel--selected} { | ||
@include tabs-bar.tabs-panel--selected; | ||
} |
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,55 @@ | ||
@use '../../tokens'; | ||
@use '../../mixins/utility'; | ||
@use '../../functions'; | ||
|
||
$selector-tab: "[role=tab]"; | ||
$selector-tab--selected: $selector-tab + "[aria-selected=true]"; | ||
$selector-tab-panel: "[role=tabpanel]"; | ||
$selector-tab-panel--selected: $selector-tab-panel + "[aria-hidden=false]"; | ||
$selector-tabs-bar: "[role=tablist]"; | ||
|
||
@mixin tab { | ||
@include utility.add-border($sides: "bottom"); | ||
@include utility.add-border-color; | ||
@include utility.padding-horizontal(5); | ||
@include utility.padding-vertical(4); | ||
@include utility.font-weight('medium'); | ||
@include utility.min-width(10); | ||
|
||
color: map-get(tokens.$theme-colors, 'primary'); | ||
text-decoration: none; | ||
text-align: center; | ||
|
||
@include utility.add-hover-state; | ||
@include utility.add-focus; | ||
} | ||
|
||
@mixin tab--selected { | ||
@include utility.add-border($sides: ("top", "right", "left")); | ||
@include utility.add-border-color; | ||
|
||
border-bottom: tokens.$border-width transparent; | ||
color: map-get(tokens.$grey, 1); | ||
|
||
@include utility.add-hover-state; | ||
} | ||
|
||
@mixin tabs-bar { | ||
display: flex; | ||
|
||
&::after { | ||
@include utility.add-border($sides: ("bottom")); | ||
@include utility.add-border-color; | ||
content: ''; | ||
display: block; | ||
flex-grow: 1; | ||
} | ||
} | ||
|
||
@mixin tabs-panel { | ||
display: none; | ||
} | ||
|
||
@mixin tabs-panel--selected { | ||
display: block; | ||
} |
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 |
---|---|---|
@@ -1,8 +1,19 @@ | ||
@use '../../tokens'; | ||
|
||
@mixin add-border-radius() { | ||
border-radius: tokens.$border-radius; | ||
} | ||
|
||
@mixin add-border() { | ||
border: solid tokens.$border-width; | ||
@mixin add-border($sides: false) { | ||
@if not $sides { | ||
border: solid tokens.$border-width; | ||
} @else { | ||
@each $side in $sides { | ||
border-#{$side}: solid tokens.$border-width; | ||
} | ||
} | ||
} | ||
|
||
@mixin add-border-color() { | ||
border-color: tokens.$border-color-default; | ||
} |
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
|
||
&:hover { | ||
background: $color; | ||
color: white; | ||
} | ||
} | ||
|
||
|
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
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
@use 'color'; | ||
|
||
$radius: 4px; | ||
$width: 1px; | ||
$color-default: map-get(color.$grey, 4) |
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 |
---|---|---|
|
@@ -8,4 +8,6 @@ $spacing: ( | |
6: 1.5rem, | ||
7: 2rem, | ||
8: 4rem, | ||
9: 6rem, | ||
10: 8rem | ||
); |