Skip to content

Commit

Permalink
fix: tabs divider
Browse files Browse the repository at this point in the history
  • Loading branch information
Rickk137 committed Oct 12, 2022
1 parent 836a665 commit 2ce3037
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/ui/src/1_atoms/Tabs/Tabs.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.content {
&.primaryWithBorder,
&.primary {
@apply bg-gray-80 rounded-b;
@apply bg-gray-80 rounded-b text-gray-10;
}

&.primaryWithBorder {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/1_atoms/Tabs/Tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Primary.args = {
},
],
index: 0,
contentClassName: 'p-4',
contentClassName: 'p-6',
size: TabSize.normal,
type: TabType.primaryWithBorder,
};
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/1_atoms/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ export const Tabs: React.FC<TabsProps> = ({
<Tab
key={i}
active={index === i}
index={i}
disabled={item.disabled}
onClick={() => selectTab(item, i)}
content={item.label}
dataActionId={item.dataActionId}
type={type}
size={size}
activeIndex={index}
activeClassName={item.activeClassName}
/>
))}
Expand Down
15 changes: 12 additions & 3 deletions packages/ui/src/1_atoms/Tabs/components/Tab/Tab.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.button {
@apply cursor-pointer inline-flex box-border items-center justify-center text-center rounded cursor-pointer transition-colors;
@apply cursor-pointer inline-flex box-border items-center justify-center text-center rounded cursor-pointer transition-colors relative;

&.primaryWithBorder,
&.primary {
Expand All @@ -19,8 +19,12 @@
}
}

&.primaryWithBorder {
@apply border-b;
}

&.primaryWithBorder.active {
@apply border-x border-x-gray-50;
@apply border-x border-x-gray-50 pb-0.5 border-b-transparent;

&:last-child {
@apply border-r-0;
Expand All @@ -32,7 +36,12 @@
}

&.primaryWithBorder:not(.active) {
@apply border-b border-b-gray-50;
@apply border-b-gray-50 border-r border-r-gray-50 rounded-none border-t-0;

&:last-child,
&.noRightBorder {
@apply border-r-0;
}
}

&.secondary {
Expand Down
9 changes: 7 additions & 2 deletions packages/ui/src/1_atoms/Tabs/components/Tab/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,38 @@ import styles from './Tab.module.css';

type TabProps = {
content: React.ReactNode;
active: boolean;
disabled?: boolean;
active: boolean;
onClick: () => void;
className?: string;
dataActionId?: string;
type: TabType;
size: TabSize;
activeClassName?: string;
index: number;
activeIndex: number;
};

export const Tab: React.FC<TabProps> = ({
content,
active,
onClick,
disabled,
className,
dataActionId,
type,
size,
active,
activeClassName = '',
activeIndex,
index,
}) => (
<button
type="button"
className={classNames(
{
[styles.active]: active,
[activeClassName]: active,
[styles.noRightBorder]: activeIndex - 1 === index,
},
className,
styles.button,
Expand Down

0 comments on commit 2ce3037

Please sign in to comment.