Skip to content

Commit 0eefc02

Browse files
committed
improve tabs style
1 parent c461dda commit 0eefc02

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/components/Tabs/Tabs.module.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
.container {
22
@apply mt-4;
33
}
4+
.tablist {
5+
@apply border-0 border-b border-solid border-black mb-4;
6+
}
7+
8+
.tablist button {
9+
@apply bg-transparent text-black border-none text-xl font-semibold leading-8 outline-none mb-[-1px] mr-12 capitalize;
10+
}
11+
12+
button.primary,
13+
button.contentTabPrimary {
14+
@apply text-link border-link border-0 border-b-4 border-solid;
15+
}
16+
17+
button.secondary {
18+
}
419

520
.tab {
621
@apply py-1 px-2 mr-2;

src/components/Tabs/Tabs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function Tabs({ sharedStore, ...slots }: Props) {
6565

6666
return (
6767
<div class={styles.container}>
68-
<div role="tablist" onKeyDown={moveFocus}>
68+
<div role="tablist" class={styles.tablist} onKeyDown={moveFocus}>
6969
{tabs.map(([key, content]) => (
7070
<button
7171
ref={(el) => (tabButtonRefs.current[key] = el)}
@@ -79,7 +79,7 @@ export function Tabs({ sharedStore, ...slots }: Props) {
7979
data-astro-tab
8080
id={key}
8181
key={key}
82-
class={clsx(curr === getBaseKeyFromTab(key) ? button.primary : button.secondary, styles.tab)}
82+
class={clsx(curr === getBaseKeyFromTab(key) ? styles.primary : styles.secondary, styles.tab)}
8383
>
8484
{content}
8585
</button>

src/components/Tabs/TabsContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function TabsContent({ sharedStore, ...slots }: Props) {
6464

6565
return (
6666
<div className={styles.contentContainer}>
67-
<div role="tablist" onKeyDown={moveFocus}>
67+
<div role="tablist" class={styles.tablist} onKeyDown={moveFocus}>
6868
{tabs.map(([key, content]) => (
6969
<button
7070
ref={(el) => (tabButtonRefs.current[key] = el)}

0 commit comments

Comments
 (0)