Skip to content

Commit

Permalink
💄 - style: improve presentation of Tabs compononent
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Aug 15, 2024
1 parent 052d81b commit 35b4608
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
18 changes: 4 additions & 14 deletions src/components/tabs/tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
width: 100%;

&__tablist {
align-items: center;
background-color: var(--typography-color-background);
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--spacing-v);
box-sizing: border-box;
border: 1px solid var(--typography-color-border);
border-radius: var(--border-radius-l);
background-color: var(--typography-color-background);
padding: var(--spacing-v) var(--spacing-h);
padding-block: var(--spacing-h);
width: 100%;
}

Expand All @@ -21,17 +19,9 @@
user-select: none;
}

&__content {
margin-block-start: var(--spacing-h);
}

@media screen and (max-width: constants.$breakpoint-desktop) {
&__tablist {
justify-content: center;
}

.mykn-p {
display: none;
}
}
}
7 changes: 3 additions & 4 deletions src/components/tabs/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, { Children, ReactElement, isValidElement, useState } from "react";

import { slugify } from "../../lib/format/string";
import { Button } from "../button";
import { P } from "../typography";
import "./tabs.scss";

export type TabsProps = React.PropsWithChildren<{
Expand Down Expand Up @@ -42,16 +41,16 @@ export const Tabs: React.FC<TabsProps> = ({
<React.Fragment key={tab.props.id || slugify(tab.props.label)}>
<Button
active={activeTab === index}
aria-controls={`tab-content-${tab.props.id || slugify(tab.props.label)}`}
aria-selected={activeTab === index ? "true" : "false"}
id={`tab-${tab.props.id || slugify(tab.props.label)}`}
pad="h"
role="tab"
variant="transparent"
aria-controls={`tab-content-${tab.props.id || slugify(tab.props.label)}`}
aria-selected={activeTab === index ? "true" : "false"}
onClick={() => handleTabClick(index)}
>
{tab.props.label}
</Button>
{index < tabs.length - 1 && <P aria-hidden="true">|</P>}
</React.Fragment>
))}
</nav>
Expand Down

0 comments on commit 35b4608

Please sign in to comment.