-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b320c2
commit d3b7b7b
Showing
20 changed files
with
389 additions
and
132 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,5 @@ | ||
--- | ||
'@utilitywarehouse/native-ui': minor | ||
--- | ||
|
||
Add `Text` and `Heading` components |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@utilitywarehouse/native-ui': patch | ||
--- | ||
|
||
Update `Badge` font size |
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
48 changes: 48 additions & 0 deletions
48
apps/native-ui-storybook/components/Heading/Heading.docs.mdx
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,48 @@ | ||
import { Meta, Canvas, Story, Controls, Primary } from '@storybook/blocks'; | ||
import * as Stories from './Heading.stories'; | ||
import { Center, Pressable, Text, Heading, NativeUIProvider } from '@utilitywarehouse/native-ui'; | ||
|
||
<Meta of={Stories} /> | ||
|
||
# Heading | ||
|
||
The `Heading` component gives you the ability to create headings for your screen with different sizes and semantics from h1 to h6. | ||
|
||
## Playground | ||
|
||
<Primary /> | ||
|
||
<Controls /> | ||
|
||
## Usage | ||
|
||
> This component should be wrapped in a `NativeUIProvider` component to ensure that the correct theme is applied. | ||
<Canvas> | ||
<NativeUIProvider> | ||
<Center> | ||
<Heading size="h4">Welcome to Utility Warehouse</Heading> | ||
</Center> | ||
</NativeUIProvider> | ||
</Canvas> | ||
|
||
```jsx | ||
import { Heading } from '@utilitywarehouse/native-ui'; | ||
|
||
const MyComponent = () => <Heading size="h4">Welcome to Utility Warehouse</Heading>; | ||
``` | ||
|
||
## Props | ||
|
||
| Property | Type | Description | Default | | ||
| --------------- | ---------------------------------------------- | ----------------------------------- | ------- | | ||
| `size` | `'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6'` | The size of the heading. | 'h4' | | ||
| `truncated` | `boolean` | Truncate the text with an ellipsis. | `false` | | ||
| `underline` | `boolean` | Underline the text. | `false` | | ||
| `strikeThrough` | `boolean` | Strike through the text. | `false` | | ||
|
||
## Variants | ||
|
||
The `Heading` component has different variants to style the text. | ||
|
||
<Canvas of={Stories.Variants} /> |
14 changes: 14 additions & 0 deletions
14
apps/native-ui-storybook/components/Heading/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,14 @@ | ||
import Heading from './Heading'; | ||
import Variants from './Variants'; | ||
import type { Meta } from '@storybook/react'; | ||
|
||
const HeadingMeta: Meta<typeof Heading> = { | ||
title: 'Native UI / Components / Heading', | ||
component: Heading, | ||
argTypes: {}, | ||
args: {}, | ||
}; | ||
|
||
export default HeadingMeta; | ||
|
||
export { Heading as Playground, Variants }; |
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,46 @@ | ||
import React from 'react'; | ||
import { Center, Heading } from '@utilitywarehouse/native-ui'; | ||
import { Meta } from '@storybook/react'; | ||
|
||
const HeadingBasic = ({ ...props }: any) => { | ||
return ( | ||
<Heading {...props}> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut | ||
labore et dolore magna aliqua. | ||
</Heading> | ||
); | ||
}; | ||
|
||
HeadingBasic.argTypes = { | ||
size: { | ||
options: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], | ||
control: 'select', | ||
description: 'The size of the heading.', | ||
}, | ||
truncated: { | ||
type: 'boolean', | ||
control: 'boolean', | ||
description: 'Truncate the heading.', | ||
}, | ||
underline: { | ||
type: 'boolean', | ||
control: 'boolean', | ||
description: 'Underline the heading.', | ||
}, | ||
strikeThrough: { | ||
type: 'boolean', | ||
control: 'boolean', | ||
description: 'Strike through the heading.', | ||
}, | ||
} as Meta<typeof Heading>['argTypes']; | ||
|
||
HeadingBasic.args = { | ||
size: 'h4', | ||
truncated: false, | ||
underline: false, | ||
strikeThrough: false, | ||
} as Meta<typeof Heading>['args']; | ||
|
||
export default HeadingBasic; | ||
|
||
export { Heading, Center }; |
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,34 @@ | ||
import React from 'react'; | ||
import { Center, Heading, VStack } from '@utilitywarehouse/native-ui'; | ||
import { VariantTitle } from '../../docs/components'; | ||
|
||
const HeadingBasic = () => { | ||
return ( | ||
<VStack gap="$6"> | ||
<VariantTitle title="Heading 1"> | ||
<Heading size="h1">Aeonik - Bold (700), 32px Size / 40px Line height / 0px Letter</Heading> | ||
</VariantTitle> | ||
<VariantTitle title="Heading 2"> | ||
<Heading size="h2">Aeonik - Bold (700), 28px Size / 32px Line height / 0px Letter</Heading> | ||
</VariantTitle> | ||
<VariantTitle title="Heading 3"> | ||
<Heading size="h3">Aeonik - Bold (700), 24px Size / 32px Line height / 0px Letter</Heading> | ||
</VariantTitle> | ||
<VariantTitle title="Heading 4"> | ||
<Heading size="h4">Aeonik - Bold (700), 18px Size / 24px Line height / 0px Letter</Heading> | ||
</VariantTitle> | ||
<VariantTitle title="Heading 5"> | ||
<Heading size="h5">Aeonik - Bold (700), 16px Size / 20px Line height / 0px Letter</Heading> | ||
</VariantTitle> | ||
<VariantTitle title="Heading 6"> | ||
<Heading size="h6"> | ||
Work Sans - Regular (400), 16px Size / 24px Line height / 0px Letter | ||
</Heading> | ||
</VariantTitle> | ||
</VStack> | ||
); | ||
}; | ||
|
||
export default HeadingBasic; | ||
|
||
export { Heading, Center }; |
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,61 @@ | ||
import { Meta, Canvas, Story, Controls, Primary } from '@storybook/blocks'; | ||
import * as Stories from './Text.stories'; | ||
import { Center, Pressable, Text, NativeUIProvider } from '@utilitywarehouse/native-ui'; | ||
|
||
<Meta of={Stories} /> | ||
|
||
# Text | ||
|
||
The `Text` component gives you the ability to create text for your screen. It can be used to display text in different sizes and styles. | ||
|
||
## Playground | ||
|
||
<Primary /> | ||
|
||
<Controls /> | ||
|
||
## Usage | ||
|
||
> This component should be wrapped in a `NativeUIProvider` component to ensure that the correct theme is applied. | ||
<Canvas> | ||
<NativeUIProvider> | ||
<Center> | ||
<Text> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut | ||
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco | ||
laboris nisi ut aliquip ex ea commodo consequat. | ||
</Text> | ||
</Center> | ||
</NativeUIProvider> | ||
</Canvas> | ||
|
||
```jsx | ||
import { Heading } from '@utilitywarehouse/native-ui'; | ||
|
||
const MyComponent = () => ( | ||
<Text> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut | ||
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco | ||
laboris nisi ut aliquip ex ea commodo consequat. | ||
</Text> | ||
); | ||
``` | ||
|
||
## Props | ||
|
||
| Property | Type | Description | Default | | ||
| --------------- | ---------------------- | ----------------------------------- | ------- | | ||
| `size` | `'xs' \| 'sm' \| 'md'` | The size of the text. | 'md' | | ||
| `highlight` | `boolean` | Highlight the text. | `false` | | ||
| `strikeThrough` | `boolean` | Strike through the text. | `false` | | ||
| `truncated` | `boolean` | Truncate the text with an ellipsis. | `false` | | ||
| `underline` | `boolean` | Underline the text. | `false` | | ||
| `bold` | `boolean` | Bold the text. | `false` | | ||
| `italic` | `boolean` | Italicise the text. | `false` | | ||
|
||
## Variants | ||
|
||
The `Text` component has different variants to style the text. | ||
|
||
<Canvas of={Stories.Variants} /> |
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,14 @@ | ||
import Text from './Text'; | ||
import Variants from './Variants'; | ||
import type { Meta } from '@storybook/react'; | ||
|
||
const TextMeta: Meta<typeof Text> = { | ||
title: 'Native UI / Components / Text', | ||
component: Text, | ||
argTypes: {}, | ||
args: {}, | ||
}; | ||
|
||
export default TextMeta; | ||
|
||
export { Text as Playground, Variants }; |
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,67 @@ | ||
import React from 'react'; | ||
import { Center, Text } from '@utilitywarehouse/native-ui'; | ||
import { Meta } from '@storybook/react'; | ||
|
||
const TextBasic = ({ ...props }: any) => { | ||
return ( | ||
<Text {...props}> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut | ||
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco | ||
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in | ||
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat | ||
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | ||
</Text> | ||
); | ||
}; | ||
|
||
TextBasic.argTypes = { | ||
size: { | ||
options: ['xs', 'sm', 'md'], | ||
control: 'select', | ||
description: 'The size of the text.', | ||
}, | ||
highlight: { | ||
type: 'boolean', | ||
control: 'boolean', | ||
description: 'Highlight the text.', | ||
}, | ||
truncated: { | ||
type: 'boolean', | ||
control: 'boolean', | ||
description: 'Truncate the text.', | ||
}, | ||
bold: { | ||
type: 'boolean', | ||
control: 'boolean', | ||
description: 'Bold the text.', | ||
}, | ||
italic: { | ||
type: 'boolean', | ||
control: 'boolean', | ||
description: 'Italicize the text.', | ||
}, | ||
underline: { | ||
type: 'boolean', | ||
control: 'boolean', | ||
description: 'Underline the text.', | ||
}, | ||
strikeThrough: { | ||
type: 'boolean', | ||
control: 'boolean', | ||
description: 'Strike through the text.', | ||
}, | ||
} as Meta<typeof Text>['argTypes']; | ||
|
||
TextBasic.args = { | ||
size: 'md', | ||
highlight: false, | ||
truncated: false, | ||
bold: false, | ||
italic: false, | ||
underline: false, | ||
strikeThrough: false, | ||
} as Meta<typeof Text>['args']; | ||
|
||
export default TextBasic; | ||
|
||
export { Text, Center }; |
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,38 @@ | ||
import React from 'react'; | ||
import { Center, Text, VStack } from '@utilitywarehouse/native-ui'; | ||
import { VariantTitle } from '../../docs/components'; | ||
|
||
const TextBasic = () => { | ||
return ( | ||
<VStack gap="$6"> | ||
<VariantTitle title="Default - Body / Medium"> | ||
<Text>Work Sans - Regular (400), 16px Size / 24px Line height / 0px Letter</Text> | ||
</VariantTitle> | ||
<VariantTitle title="Default - Body / Medium - Strikethrough"> | ||
<Text strikeThrough> | ||
Work Sans - Regular (400), 16px Size / 24px Line height / 0px Letter | ||
</Text> | ||
</VariantTitle> | ||
<VariantTitle title="Default - Body / Medium - Highlight"> | ||
<Text highlight> | ||
Work Sans - Semi Bold (600), 16px Size / 24px Line height / 0px Letter | ||
</Text> | ||
</VariantTitle> | ||
<VariantTitle title="Body Small"> | ||
<Text size="sm">Work Sans - Regular (400), 14px Size / 16px Line height / 0px Letter</Text> | ||
</VariantTitle> | ||
<VariantTitle title="Body Small - Highlighted"> | ||
<Text size="sm" highlight> | ||
Work Sans - Semi Bold (600), 14px Size / 16px Line height / 0px Letter | ||
</Text> | ||
</VariantTitle> | ||
<VariantTitle title="Body X-Small"> | ||
<Text size="xs">Work Sans - Regular (400), 12px Size / 16px Line height / 0px Letter</Text> | ||
</VariantTitle> | ||
</VStack> | ||
); | ||
}; | ||
|
||
export default TextBasic; | ||
|
||
export { Text, Center }; |
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,12 @@ | ||
import { Box, Text } from '@utilitywarehouse/native-ui'; | ||
|
||
const VariantTitle = ({ title, children }: any) => ( | ||
<Box gap="$2"> | ||
<Text textTransform="uppercase" size="xs" highlight color="$grey600"> | ||
{title} | ||
</Text> | ||
{children} | ||
</Box> | ||
); | ||
|
||
export default VariantTitle; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default as BackToTopButton } from './BackToTopButton'; | ||
export { default as ViewFigmaButton } from './ViewFigmaButton'; | ||
export { default as ScrollWrap } from './ScrollWrap'; | ||
export { default as VariantTitle } from './VariantTitle'; |
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
Oops, something went wrong.