Skip to content

Commit ed56440

Browse files
committed
feat: accentHintColor
1 parent c07367e commit ed56440

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

example/src/stories/Tab/Tab.stories.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export default {
3030
control: 'color',
3131
description: 'The accent color of the tab',
3232
},
33+
accentHintColor: {
34+
control: 'color',
35+
description: 'The accent hint color of the tab',
36+
},
3337
as: {
3438
control: { type: 'select', options: ['div', 'span', 'button', 'a'] },
3539
description: 'The element to render the item as',

src/components/$Tab/Tab.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const { vars, v, styles } = cssVariables(
1212
{
1313
...transparentHoverTemplate,
1414
accentColor: (theme) => theme.color.background.table.header,
15+
accentHintColor: (theme) => 'transparent',
1516
},
1617
'tab'
1718
)
@@ -40,7 +41,7 @@ const TabContainer = styled.button<TabContainerProps>`
4041
text-align: center;
4142
user-select: none;
4243
border: none;
43-
border-bottom: 2px solid transparent;
44+
border-bottom: 2px solid ${v.accentHintColor};
4445
transition: background-color 0.3s ease, color 0.3s ease,
4546
border-color 0.3s ease;
4647
background: ${v.backgroundColor};
@@ -61,6 +62,7 @@ export interface TabProps {
6162
backgroundColor?: string
6263
hoverColor?: string
6364
accentColor?: string
65+
accentHintColor?: string
6466
}
6567

6668
export const Tab: PC<'a', TabProps> = forwardRefWithGenerics(
@@ -73,6 +75,7 @@ export const Tab: PC<'a', TabProps> = forwardRefWithGenerics(
7375
disabled = false,
7476
hoverColor,
7577
accentColor,
78+
accentHintColor,
7679
style,
7780
as = 'a',
7881
...rest
@@ -102,6 +105,7 @@ export const Tab: PC<'a', TabProps> = forwardRefWithGenerics(
102105
computedHoverColor &&
103106
readableColor(computedHoverColor, solvedTheme),
104107
[vars.accentColor]: computedAccentColor,
108+
[vars.accentHintColor]: accentHintColor,
105109
...style,
106110
}}
107111
{...rest}

0 commit comments

Comments
 (0)