Skip to content

Commit f260f52

Browse files
feat(tabs): enhance tab structure by replacing secondaryLabel with extension
1 parent c512d6d commit f260f52

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

packages/ui-components/src/Common/CodeTabs/index.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export default {
6767
children: <TabsContent />,
6868
defaultValue: 'mjs',
6969
tabs: [
70-
{ key: 'mjs', label: 'Example', secondaryLabel: 'MJS' },
71-
{ key: 'cjs', label: 'Example', secondaryLabel: 'CJS' },
70+
{ key: 'mjs', label: 'Example', extension: 'MJS' },
71+
{ key: 'cjs', label: 'Example', extension: 'CJS' },
7272
],
7373
},
7474
} as Meta;

packages/ui-components/src/Common/Tabs/index.module.css

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@
2222
text-neutral-800
2323
dark:text-neutral-200;
2424

25-
.tabSecondaryLabel {
25+
.tabExtension {
2626
@apply ml-1
27-
rounded
27+
rounded-xs
2828
border
29-
border-neutral-500
30-
px-1
31-
py-0.5
32-
text-xs
29+
border-neutral-200
30+
p-0.5
31+
text-[10px]
32+
font-normal
33+
text-neutral-800
34+
dark:text-neutral-200;
35+
}
36+
37+
.tabSecondaryLabel {
38+
@apply pl-1
3339
text-neutral-500
34-
dark:border-neutral-800
3540
dark:text-neutral-800;
3641
}
3742

@@ -41,10 +46,15 @@
4146
dark:border-b-green-400
4247
dark:text-green-400;
4348

49+
.tabExtension {
50+
@apply border-green-600
51+
text-green-600
52+
dark:border-green-400
53+
dark:text-green-400;
54+
}
55+
4456
.tabSecondaryLabel {
45-
@apply border-green-800
46-
text-green-800
47-
dark:border-green-600
57+
@apply text-green-800
4858
dark:text-green-600;
4959
}
5060
}

packages/ui-components/src/Common/Tabs/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type Tab = {
1010
label: string;
1111
secondaryLabel?: string;
1212
value?: string;
13+
extension?: string;
1314
};
1415

1516
type TabsProps = TabsPrimitive.TabsProps & {
@@ -37,6 +38,9 @@ const Tabs: FC<PropsWithChildren<TabsProps>> = ({
3738
className={classNames(styles.tabsTrigger, triggerClassName)}
3839
>
3940
{tab.label}
41+
{tab.extension ? (
42+
<span className={styles.tabExtension}>{tab.extension}</span>
43+
) : null}
4044
{tab.secondaryLabel ? (
4145
<span className={styles.tabSecondaryLabel}>
4246
{tab.secondaryLabel}

0 commit comments

Comments
 (0)