-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #909 from openameba/feature/add-navigation-tab
feat(spindle-ui): add `NavigationTab/UnderlineTab` component
- Loading branch information
Showing
8 changed files
with
886 additions
and
33 deletions.
There are no files selected for viewing
213 changes: 213 additions & 0 deletions
213
packages/spindle-ui/src/NavigationTab/UnderlineTab/UnderlineTab.css
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,213 @@ | ||
.spui-UnderlineTab { | ||
background-color: var(--color-surface-primary); | ||
} | ||
|
||
.spui-UnderlineTab--border { | ||
border-bottom: 1px solid var(--color-border-low-emphasis); | ||
} | ||
|
||
.spui-UnderlineTab--scrollable { | ||
position: relative; | ||
} | ||
|
||
.spui-UnderlineTab-container { | ||
align-items: center; | ||
display: flex; | ||
} | ||
|
||
.spui-UnderlineTab--scrollable .spui-UnderlineTab-container { | ||
column-gap: 16px; | ||
overflow-x: scroll; | ||
padding: 0 16px; | ||
scroll-behavior: smooth; | ||
} | ||
|
||
.spui-UnderlineTab-button { | ||
background-color: transparent; | ||
border: none; | ||
box-sizing: border-box; | ||
flex-shrink: 0; | ||
padding: 0 4px; | ||
transition: background-color 0.15s ease-in-out; | ||
} | ||
|
||
.spui-UnderlineTab--fixed .spui-UnderlineTab-button { | ||
width: 100%; | ||
} | ||
|
||
.spui-UnderlineTab--scrollable .spui-UnderlineTab-button { | ||
min-width: 44px; | ||
} | ||
|
||
.spui-UnderlineTab-button:hover { | ||
background-color: var(--color-surface-tertiary); | ||
} | ||
|
||
.spui-UnderlineTab-button:focus { | ||
border-radius: 4px; | ||
outline: 2px solid var(--color-focus-clarity); | ||
outline-offset: -2px; | ||
} | ||
|
||
.spui-UnderlineTab-button:not(:focus-visible) { | ||
outline: none; | ||
} | ||
|
||
.spui-UnderlineTab-labelWrapper { | ||
align-items: center; | ||
column-gap: 6px; | ||
display: flex; | ||
margin: 0 auto; | ||
max-width: 100%; | ||
padding: 14px 0; | ||
position: relative; | ||
width: fit-content; | ||
} | ||
|
||
.spui-UnderlineTab-labelWrapper::after { | ||
background-color: var(--color-border-accent-primary); | ||
border-radius: 3px; | ||
bottom: 0; | ||
content: ''; | ||
height: 3px; | ||
left: 50%; | ||
min-width: 40px; | ||
opacity: 0; | ||
position: absolute; | ||
transform: translateX(-50%); | ||
transition: opacity 0.35s ease-in-out; | ||
width: 100%; | ||
} | ||
|
||
/* stylelint-disable-next-line */ | ||
.spui-UnderlineTab-button[aria-selected='true'] .spui-UnderlineTab-labelWrapper::after { | ||
opacity: 1; | ||
} | ||
|
||
.spui-UnderlineTab-label { | ||
color: var(--color-text-low-emphasis); | ||
font-size: 0.875rem; | ||
font-weight: bold; | ||
line-height: 1.3; | ||
} | ||
|
||
.spui-UnderlineTab--fixed .spui-UnderlineTab-label { | ||
min-width: 0; | ||
overflow-wrap: break-word; | ||
} | ||
|
||
/* stylelint-disable-next-line */ | ||
.spui-UnderlineTab-button[aria-selected='true'] .spui-UnderlineTab-label { | ||
color: var(--color-text-accent-primary); | ||
} | ||
|
||
.spui-UnderlineTab-badge { | ||
background-color: var(--color-surface-accent-primary); | ||
border-radius: 8px; | ||
box-sizing: border-box; | ||
color: var(--color-text-high-emphasis-inverse); | ||
flex-shrink: 0; | ||
font-size: 0.6875rem; | ||
font-weight: bold; | ||
line-height: 1.3; | ||
min-width: 20px; | ||
padding: 1px 4px; | ||
} | ||
|
||
.spui-UnderlineTab-visuallyHidden { | ||
clip: rect(1px, 1px, 1px, 1px); | ||
clip-path: inset(50%); | ||
height: 1px; | ||
overflow: hidden; | ||
position: absolute; | ||
width: 1px; | ||
} | ||
|
||
.spui-UnderlineTab-arrow { | ||
background-color: var(--color-surface-primary); | ||
bottom: 0; | ||
height: fit-content; | ||
margin: auto; | ||
opacity: 0; | ||
position: absolute; | ||
top: 0; | ||
transition: | ||
opacity 0.35s ease-in-out, | ||
visibility 0.35s ease-in-out; | ||
visibility: hidden; | ||
z-index: 1; | ||
} | ||
|
||
.spui-UnderlineTab-arrow.is-showed { | ||
opacity: 1; | ||
visibility: visible; | ||
} | ||
|
||
.spui-UnderlineTab-arrow::before { | ||
content: ''; | ||
height: 100%; | ||
position: absolute; | ||
width: 10px; | ||
z-index: -1; | ||
} | ||
|
||
.spui-UnderlineTab-arrow--left { | ||
left: 0; | ||
} | ||
|
||
.spui-UnderlineTab-arrow--left::before { | ||
background: linear-gradient( | ||
270deg, | ||
rgba(255, 255, 255, 0) 0, | ||
var(--color-surface-primary) 100% | ||
); | ||
left: 44px; /* ボタンの横幅分 */ | ||
} | ||
|
||
.spui-UnderlineTab-arrow--right { | ||
right: 0; | ||
} | ||
|
||
.spui-UnderlineTab-arrow--right::before { | ||
background: linear-gradient( | ||
270deg, | ||
var(--color-surface-primary) 0, | ||
rgba(255, 255, 255, 0) 100% | ||
); | ||
right: 44px; /* ボタンの横幅分 */ | ||
} | ||
|
||
.spui-UnderlineTab-arrowButton { | ||
background-color: transparent; | ||
border: none; | ||
border-radius: 8px; | ||
color: var(--color-object-low-emphasis); | ||
display: flex; | ||
padding: 14px; | ||
transition: background-color 0.15s ease-in-out; | ||
} | ||
|
||
.spui-UnderlineTab-arrowButton:hover { | ||
background-color: var(--color-surface-tertiary); | ||
} | ||
|
||
.spui-UnderlineTab-arrowButton:focus { | ||
outline: 2px solid var(--color-focus-clarity); | ||
} | ||
|
||
.spui-UnderlineTab-arrowButton:not(:focus-visible) { | ||
outline: none; | ||
} | ||
|
||
@media (prefers-reduced-motion: reduce) { | ||
.spui-UnderlineTab-button, | ||
.spui-UnderlineTab-labelWrapper::after, | ||
.spui-UnderlineTab-arrow, | ||
.spui-UnderlineTab-arrowButton { | ||
transition: 0.1ms; | ||
} | ||
|
||
.spui-UnderlineTab--scrollable .spui-UnderlineTab-container { | ||
scroll-behavior: auto; | ||
} | ||
} |
Oops, something went wrong.