Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ const TabsContent: FC = () => (

export const Default: Story = {};

export const WithExtension: Story = {
args: {
tabs: [
{ key: 'mjs', label: 'Example', extension: 'MJS' },
{ key: 'cjs', label: 'Example', extension: 'CJS' },
],
},
};

export default {
component: CodeTabs,
args: {
Expand Down
17 changes: 17 additions & 0 deletions packages/ui-components/src/Common/Tabs/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
text-neutral-800
dark:text-neutral-200;

.tabExtension {
@apply ml-1
rounded-xs
border
border-neutral-200
px-1
py-0.5
text-xs
font-normal
text-neutral-200;
}

.tabSecondaryLabel {
@apply pl-1
text-neutral-500
Expand All @@ -34,6 +46,11 @@
dark:border-b-green-400
dark:text-green-400;

.tabExtension {
@apply border-green-400
text-green-400;
}

.tabSecondaryLabel {
@apply text-green-800
dark:text-green-600;
Expand Down
4 changes: 4 additions & 0 deletions packages/ui-components/src/Common/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Tab = {
label: string;
secondaryLabel?: string;
value?: string;
extension?: string;
};

type TabsProps = TabsPrimitive.TabsProps & {
Expand Down Expand Up @@ -37,6 +38,9 @@ const Tabs: FC<PropsWithChildren<TabsProps>> = ({
className={classNames(styles.tabsTrigger, triggerClassName)}
>
{tab.label}
{tab.extension && (
<span className={styles.tabExtension}>{tab.extension}</span>
)}
{tab.secondaryLabel ? (
<span className={styles.tabSecondaryLabel}>
{tab.secondaryLabel}
Expand Down
Loading