Skip to content

Improve tabs style #247

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

Merged
merged 1 commit into from
May 20, 2024
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
15 changes: 15 additions & 0 deletions src/components/Tabs/Tabs.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
.container {
@apply mt-4;
}
.tablist {
@apply border-0 border-b border-solid border-black mb-4;
}

.tablist button {
@apply bg-transparent text-black border-none text-xl font-semibold leading-8 outline-none mb-[-1px] mr-12 capitalize;
}

button.primary,
button.contentTabPrimary {
@apply text-link border-link border-0 border-b-4 border-solid;
}

button.secondary {
}

.tab {
@apply py-1 px-2 mr-2;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function Tabs({ sharedStore, ...slots }: Props) {

return (
<div class={styles.container}>
<div role="tablist" onKeyDown={moveFocus}>
<div role="tablist" class={styles.tablist} onKeyDown={moveFocus}>
{tabs.map(([key, content]) => (
<button
ref={(el) => (tabButtonRefs.current[key] = el)}
Expand All @@ -79,7 +79,7 @@ export function Tabs({ sharedStore, ...slots }: Props) {
data-astro-tab
id={key}
key={key}
class={clsx(curr === getBaseKeyFromTab(key) ? button.primary : button.secondary, styles.tab)}
class={clsx(curr === getBaseKeyFromTab(key) ? styles.primary : styles.secondary, styles.tab)}
>
{content}
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tabs/TabsContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function TabsContent({ sharedStore, ...slots }: Props) {

return (
<div className={styles.contentContainer}>
<div role="tablist" onKeyDown={moveFocus}>
<div role="tablist" class={styles.tablist} onKeyDown={moveFocus}>
{tabs.map(([key, content]) => (
<button
ref={(el) => (tabButtonRefs.current[key] = el)}
Expand Down