forked from goldfinch-eng/mono
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from weavik/FAD-57-typography
[FAD-57] - Add typography
- Loading branch information
Showing
37 changed files
with
467 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from "react"; | ||
import { DocsContainer as BaseContainer } from "@storybook/addon-docs/blocks"; | ||
import { useDarkMode } from "storybook-dark-mode"; | ||
import { themes } from "@storybook/theming"; | ||
|
||
export const DocsContainer = ({ children, context }) => { | ||
const dark = useDarkMode(); | ||
|
||
return ( | ||
<BaseContainer | ||
context={{ | ||
...context, | ||
storyById: (id) => { | ||
const storyContext = context.storyById(id); | ||
return { | ||
...storyContext, | ||
parameters: { | ||
...storyContext?.parameters, | ||
docs: { | ||
...storyContext?.parameters?.docs, | ||
theme: dark ? themes.dark : themes.light, | ||
}, | ||
}, | ||
}; | ||
}, | ||
}} | ||
> | ||
{children} | ||
</BaseContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/client3/components/design-system/typography/body-text.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ComponentMeta, ComponentStory } from "@storybook/react"; | ||
|
||
import { BodyText } from "."; | ||
|
||
export default { | ||
title: "Components/Typography", | ||
component: BodyText, | ||
} as ComponentMeta<typeof BodyText>; | ||
|
||
export const BodyTextStory: ComponentStory<typeof BodyText> = (args) => ( | ||
<BodyText {...args} /> | ||
); | ||
BodyTextStory.args = { size: "large", children: "Some text" }; |
25 changes: 25 additions & 0 deletions
25
packages/client3/components/design-system/typography/body-text.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import clsx from "clsx"; | ||
import { HTMLAttributes } from "react"; | ||
|
||
export interface BodyTextProps extends HTMLAttributes<HTMLHeadingElement> { | ||
size: "large" | "medium" | "normal" | "small"; | ||
semiBold?: boolean; | ||
} | ||
|
||
export function BodyText({ | ||
size, | ||
semiBold = false, | ||
className, | ||
...rest | ||
}: BodyTextProps) { | ||
return ( | ||
<p | ||
className={clsx( | ||
`body-text-${size}`, | ||
semiBold ? "font-semibold" : "font-normal", | ||
className | ||
)} | ||
{...rest} | ||
/> | ||
); | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/client3/components/design-system/typography/caption.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ComponentMeta, ComponentStory } from "@storybook/react"; | ||
|
||
import { Caption } from "."; | ||
|
||
export default { | ||
title: "Components/Typography", | ||
component: Caption, | ||
} as ComponentMeta<typeof Caption>; | ||
|
||
export const CaptionStory: ComponentStory<typeof Caption> = (args) => { | ||
return <Caption {...args} />; | ||
}; | ||
CaptionStory.args = { | ||
children: "Caption", | ||
}; |
9 changes: 9 additions & 0 deletions
9
packages/client3/components/design-system/typography/caption.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import clsx from "clsx"; | ||
import { HTMLAttributes } from "react"; | ||
|
||
export function Caption({ | ||
className, | ||
...rest | ||
}: HTMLAttributes<HTMLHeadingElement>) { | ||
return <small className={clsx(className)} {...rest} />; | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/client3/components/design-system/typography/display.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
|
||
import { Display } from "."; | ||
|
||
export default { | ||
title: "Components/Typography", | ||
component: Display, | ||
} as ComponentMeta<typeof Display>; | ||
|
||
export const DisplayStory: ComponentStory<typeof Display> = (args) => ( | ||
<Display {...args} /> | ||
); | ||
DisplayStory.args = { level: 1, children: "Some text" }; |
15 changes: 15 additions & 0 deletions
15
packages/client3/components/design-system/typography/display.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import clsx from "clsx"; | ||
import { HTMLAttributes } from "react"; | ||
|
||
export interface DisplayProps extends HTMLAttributes<HTMLHeadingElement> { | ||
level: 1 | 2; | ||
} | ||
|
||
export function Display({ level, className, ...rest }: DisplayProps) { | ||
return ( | ||
<div | ||
className={clsx(`display-${level}`, "font-semibold", className)} | ||
{...rest} | ||
/> | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/client3/components/design-system/typography/heading.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
|
||
import { Heading } from "."; | ||
|
||
export default { | ||
title: "Components/Typography", | ||
component: Heading, | ||
argTypes: { | ||
as: { | ||
control: { | ||
type: null, | ||
}, | ||
}, | ||
}, | ||
} as ComponentMeta<typeof Heading>; | ||
|
||
export const HeadingStory: ComponentStory<typeof Heading> = (args) => ( | ||
<Heading {...args} /> | ||
); | ||
HeadingStory.args = { level: 1, medium: false, children: "Some text" }; |
Oops, something went wrong.