Skip to content

Commit

Permalink
linting error / filtered variations by type
Browse files Browse the repository at this point in the history
  • Loading branch information
fraincs committed Mar 1, 2024
1 parent 770dddf commit 5783414
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/docs/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"Card": true,
"Table": true,
"TypographyTable": true,
"TypographyTableVariation": true,
"TypographyVariantTable": true,
"Tabs": true,
"TableSection": true,
"Switcher": true,
Expand Down
12 changes: 9 additions & 3 deletions apps/docs/components/ui/table/TypographyVariantTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@ import "./table.css";

interface TypographyVariantTableProps {
data: Record<string, { name: string; value: string }[]>;
type: string;
}

const TypographyVariantTable = ({ data }: TypographyVariantTableProps) => {
const TypographyVariantTable = ({ type, data }: TypographyVariantTableProps) => {
const tokenData = data["fontWeight"];
console.log(type);

const filteredData: Array<{ name: string; value: string }> = tokenData.filter(item =>
const filteredDataByType: Array<{ name: string; value: string }> = tokenData.filter(item =>
item.name.includes(type)
);

const filteredDataByWeightVariation: Array<{ name: string; value: string }> = filteredDataByType.filter(item =>
item.name.includes("bold") ||
item.name.includes("semibold") ||
item.name.includes("medium")
);

const listItems = filteredData.map(item => {
const listItems = filteredDataByWeightVariation.map(item => {
const fontWeight = item.value;

return (
Expand Down
11 changes: 8 additions & 3 deletions apps/docs/content/tokens/semantic/typography.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Headings are used to create a hierarchy of content. They are used to help users

<TypographyTable type="heading" data={tokens.semantic} />

### Variations

<TypographyVariantTable type="heading" data={tokens.semantic} />

## Overline

Used to introduce a headline.
Expand All @@ -45,12 +49,13 @@ Body text is used to communicate the main content of a page.

<TypographyTable type="body" data={tokens.semantic} />

### Variations

<TypographyVariantTable type="body" data={tokens.semantic} />

## Accent

Accent text is used to highlight important information on a page.

<TypographyTable type="accent" data={tokens.semantic} />

## Font Weight Variations

<TypographyVariantTable data={tokens.semantic} />

0 comments on commit 5783414

Please sign in to comment.