Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions example/src/stories/Tab/Tab.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export default {
control: 'color',
description: 'The accent color of the tab',
},
accentHintColor: {
control: 'color',
description: 'The accent hint color of the tab',
},
as: {
control: { type: 'select', options: ['div', 'span', 'button', 'a'] },
description: 'The element to render the item as',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solved-ac/ui-react",
"version": "0.6.0",
"version": "0.6.1",
"description": "React component library used by solved.ac",
"author": "shiftpsh",
"license": "MIT",
Expand Down
6 changes: 5 additions & 1 deletion src/components/$Tab/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const { vars, v, styles } = cssVariables(
{
...transparentHoverTemplate,
accentColor: (theme) => theme.color.background.table.header,
accentHintColor: (theme) => 'transparent',
},
'tab'
)
Expand Down Expand Up @@ -40,7 +41,7 @@ const TabContainer = styled.button<TabContainerProps>`
text-align: center;
user-select: none;
border: none;
border-bottom: 2px solid transparent;
border-bottom: 2px solid ${v.accentHintColor};
transition: background-color 0.3s ease, color 0.3s ease,
border-color 0.3s ease;
background: ${v.backgroundColor};
Expand All @@ -61,6 +62,7 @@ export interface TabProps {
backgroundColor?: string
hoverColor?: string
accentColor?: string
accentHintColor?: string
}

export const Tab: PC<'a', TabProps> = forwardRefWithGenerics(
Expand All @@ -73,6 +75,7 @@ export const Tab: PC<'a', TabProps> = forwardRefWithGenerics(
disabled = false,
hoverColor,
accentColor,
accentHintColor,
style,
as = 'a',
...rest
Expand Down Expand Up @@ -102,6 +105,7 @@ export const Tab: PC<'a', TabProps> = forwardRefWithGenerics(
computedHoverColor &&
readableColor(computedHoverColor, solvedTheme),
[vars.accentColor]: computedAccentColor,
[vars.accentHintColor]: accentHintColor,
...style,
}}
{...rest}
Expand Down