Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing tab styles, especially in dark mode #169

Merged
merged 7 commits into from
Oct 11, 2023
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
23 changes: 16 additions & 7 deletions src/components/Tabs/Tabs.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tabs } from "@/components";
import { Spacer, Tabs, Text } from "@/components";
import type { StoryObj } from "@storybook/react";

export default {
Expand All @@ -21,24 +21,33 @@ export const Playground: Story = {
value="tab1"
key="tab1"
>
tab1
Tab 1
</Tabs.Trigger>
<Tabs.Trigger
value="tab2"
key="tab2"
>
tab2
Tab 2
</Tabs.Trigger>
<Tabs.Trigger
value="tab3"
key="tab3"
>
tab3
Tab 3
</Tabs.Trigger>
</Tabs.TriggersList>
<Tabs.Content value="tab1">Tab 1 content</Tabs.Content>
<Tabs.Content value="tab2">Tab 2 content</Tabs.Content>
<Tabs.Content value="tab3">Tab 3 content</Tabs.Content>
<Tabs.Content value="tab1">
<Spacer />
<Text>Tab 1 content</Text>
</Tabs.Content>
<Tabs.Content value="tab2">
<Spacer />
<Text>Tab 2 content</Text>
</Tabs.Content>
<Tabs.Content value="tab3">
<Spacer />
<Text>Tab 3 content</Text>
</Tabs.Content>
</>
),
},
Expand Down
22 changes: 11 additions & 11 deletions src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,38 @@ const Trigger = styled(RadixTabs.Trigger)`
border-top-left-radius: ${props => props.theme.click.tabs.radii.all};
border-top-right-radius: ${props => props.theme.click.tabs.radii.all};

border-bottom: ${props => props.theme.click.tabs.basic.stroke.default};
background-color: ${props =>
props.theme.click.tabs.basic.color.background.default};
border-bottom: 2px solid ${props => props.theme.click.tabs.basic.stroke.default};
background-color: ${props => props.theme.click.tabs.basic.color.background.default};
color: ${props => props.theme.click.tabs.basic.color.text.default};
font: ${props => props.theme.click.tabs.typography.label.default};
cursor: pointer;

&[data-state="active"] {
border-bottom: ${props => props.theme.click.tabs.basic.stroke.active};
background-color: ${props =>
props.theme.click.tabs.basic.color.background.active};
border-bottom: 2px solid ${props => props.theme.click.tabs.basic.color.stroke.active};
background-color: ${props => props.theme.click.tabs.basic.color.background.active};
color: ${props => props.theme.click.tabs.basic.color.text.active};
font: ${props => props.theme.click.tabs.typography.label.active};
&:hover {
font: ${props => props.theme.click.tabs.typography.label.active};
}
}

&:hover {
border-bottom: ${props => props.theme.click.tabs.basic.stroke.hover};
background-color: ${props =>
props.theme.click.tabs.basic.color.background.hover};
border-bottom: 2px solid ${props => props.theme.click.tabs.basic.stroke.hover};
background-color: ${props => props.theme.click.tabs.basic.color.background.hover};
color: ${props => props.theme.click.tabs.basic.color.text.hover};
font: ${props => props.theme.click.tabs.typography.label.hover};
}

&:hover[data-state="active"] {
border-bottom: ${props => props.theme.click.tabs.basic.stroke.active};
border-bottom: 2px solid ${props => props.theme.click.tabs.basic.stroke.active};
}
`;

const Content = styled(RadixTabs.Content)``;

const TriggersList = styled(RadixTabs.List)`
border-bottom: ${props => props.theme.click.tabs.basic.stroke.global};
border-bottom: 1px solid ${props => props.theme.click.global.color.stroke.default};
`;

const Tabs = ({
Expand Down
108 changes: 84 additions & 24 deletions src/styles/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -804,30 +804,60 @@
"disabled": string
}
},
"color": {
"background": {
"default": string,
"hover": string,
"active": string,
"disabled": string
},
"title": {
"default": string,
"hover": string,
"active": string,
"disabled": string
},
"description": {
"default": string,
"hover": string,
"active": string,
"disabled": string
},
"stroke": {
"default": string,
"hover": string,
"active": string,
"disabled": string
"default": {
"color": {
"background": {
"default": string,
"hover": string,
"active": string,
"disabled": string
},
"title": {
"default": string,
"hover": string,
"active": string,
"disabled": string
},
"description": {
"default": string,
"hover": string,
"active": string,
"disabled": string
},
"stroke": {
"default": string,
"hover": string,
"active": string,
"disabled": string
}
}
},
"muted": {
"color": {
"background": {
"default": string,
"hover": string,
"active": string,
"disabled": string
},
"title": {
"default": string,
"hover": string,
"active": string,
"disabled": string
},
"description": {
"default": string,
"hover": string,
"active": string,
"disabled": string
},
"stroke": {
"default": string,
"hover": string,
"active": string,
"disabled": string
}
}
}
}
Expand Down Expand Up @@ -2186,6 +2216,36 @@
}
},
"name": string,
"global": {
"color": {
"background": {
"default": string,
"muted": string
},
"text": {
"default": string,
"muted": string,
"link": {
"default": string,
"hover": string
}
},
"stroke": {
"default": string,
"muted": string,
"intense": string
},
"accent": {
"default": string
},
"outline": {
"default": string
},
"shadow": {
"default": string
}
}
},
"palette": {
"brand": {
"50": string,
Expand Down
161 changes: 160 additions & 1 deletion src/styles/variables.classic.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,92 @@
"disabled": "#a0a0a0"
}
}
},
"primary": {
"color": {
"background": {
"default": "#ffffff",
"hover": "#f6f7fa",
"active": "lch(92.4 1.49 272)",
"disabled": "#dfdfdf"
},
"title": {
"default": "#161517",
"hover": "#161517",
"active": "#161517",
"disabled": "#a0a0a0"
},
"description": {
"default": "#696e79",
"hover": "#696e79",
"active": "#696e79",
"disabled": "#a0a0a0"
},
"stroke": {
"default": "lch(91.6 1.1 266)",
"hover": "lch(91.6 1.1 266)",
"active": "#151515",
"disabled": "#dfdfdf"
}
}
},
"horizontal": {
"default": {
"color": {
"background": {
"default": "#ffffff",
"hover": "#f6f7fa",
"active": "#f6f7fa",
"disabled": "#dfdfdf"
},
"title": {
"default": "#161517",
"hover": "#161517",
"active": "#161517",
"disabled": "#a0a0a0"
},
"description": {
"default": "#696e79",
"hover": "#696e79",
"active": "#696e79",
"disabled": "#a0a0a0"
},
"stroke": {
"default": "lch(91.6 1.1 266)",
"hover": "lch(91.6 1.1 266)",
"active": "#151515",
"disabled": "#dfdfdf"
}
}
},
"muted": {
"color": {
"background": {
"default": "#f6f7fa",
"hover": "#ffffff",
"active": "#f6f7fa",
"disabled": "#dfdfdf"
},
"title": {
"default": "#161517",
"hover": "#161517",
"active": "#161517",
"disabled": "#a0a0a0"
},
"description": {
"default": "#696e79",
"hover": "#696e79",
"active": "#696e79",
"disabled": "#a0a0a0"
},
"stroke": {
"default": "lch(91.6 1.1 266)",
"hover": "lch(91.6 1.1 266)",
"active": "#151515",
"disabled": "#dfdfdf"
}
}
}
}
},
"sidebar": {
Expand Down Expand Up @@ -397,6 +483,49 @@
}
}
},
"tabs": {
"basic": {
"color": {
"background": {
"default": "rgba(0,0,0,0)",
"hover": "#f6f7fa",
"active": "rgba(0,0,0,0)"
},
"text": {
"default": "#696e79",
"hover": "#161517",
"active": "#161517"
},
"stroke": {
"default": "rgba(0,0,0,0)",
"hover": "rgba(0,0,0,0)",
"active": "#FFC029"
},
"global": {
"default": "lch(91.6 1.1 266)"
}
}
},
"fileTabs": {
"color": {
"background": {
"default": "#f6f7fa",
"hover": "#ffffff",
"active": "#ffffff"
},
"text": {
"default": "#696e79",
"hover": "#161517",
"active": "#161517"
},
"stroke": {
"default": "lch(91.6 1.1 266)",
"hover": "lch(91.6 1.1 266)",
"active": "lch(91.6 1.1 266)"
}
}
}
},
"flyout": {
"color": {
"background": {
Expand Down Expand Up @@ -432,5 +561,35 @@
}
}
},
"name": "classic"
"name": "classic",
"global": {
"color": {
"background": {
"default": "#ffffff",
"muted": "#f6f7fa"
},
"text": {
"default": "#161517",
"muted": "#696e79",
"link": {
"default": "#C78F0F",
"hover": "#C78F0F"
}
},
"stroke": {
"default": "lch(91.6 1.1 266)",
"muted": "lch(91.6 1.1 266)",
"intense": "#b3b6bd"
},
"accent": {
"default": "#151515"
},
"outline": {
"default": "#C78F0F"
},
"shadow": {
"default": "lch(6.77 0 0 / 0.15)"
}
}
}
}
Loading