forked from tari-project/tari
-
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.
Merge pull request #77 from Altalogy/launchpad/feature/text-component
feat(primitive): add text component
- Loading branch information
Showing
11 changed files
with
85 additions
and
10 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
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
import { StyledText } from './styles' | ||
import { TextProps } from './types' | ||
import styles from '../../styles/styles' | ||
|
||
/** | ||
* @name Text | ||
* | ||
* @typedef TextProps | ||
* @prop {'header' | 'subheader' | 'defaultHeavy' | 'defaultMedium' | 'defaultUnder' | 'smallHeavy' | 'smallMedium' | 'smallUnder' | 'microHeavy' | 'microRegular' | 'microOblique' } type - text styles | ||
* @prop {ReactNode} children - text content to display | ||
* @prop {string} [color] - font color | ||
* | ||
* @example | ||
* <Text type='defaultMedium' color={styles.colors.dark.primary}>...text goes here...</Text> | ||
*/ | ||
|
||
const Text = ({ | ||
type = 'defaultMedium', | ||
color, | ||
children, | ||
}: TextProps) => { | ||
const textStyles = { | ||
color: color, | ||
...styles.typography[type] | ||
} | ||
return ( | ||
<> | ||
<StyledText style={textStyles}>{children}</StyledText> | ||
</> | ||
) | ||
} | ||
|
||
export default Text |
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,3 @@ | ||
import styled from 'styled-components' | ||
|
||
export const StyledText = styled.p`` |
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,27 @@ | ||
import { ReactNode } from 'react' | ||
|
||
/** | ||
* @typedef TextProps | ||
* @prop {'header' | 'subheader' | 'defaultHeavy' | 'defaultMedium' | 'defaultUnder' | 'smallHeavy' | 'smallMedium' | 'smallUnder' | 'microHeavy' | 'microRegular' | 'microOblique' } [type] - text styles | ||
* @prop {ReactNode} children - text content to display | ||
* @prop {string} [color] - font color | ||
*/ | ||
|
||
export interface TextProps { | ||
type?: | ||
| 'header' | ||
| 'subheader' | ||
| 'defaultHeavy' | ||
| 'defaultMedium' | ||
| 'defaultUnder' | ||
| 'smallHeavy' | ||
| 'smallMedium' | ||
| 'smallUnder' | ||
| 'microHeavy' | ||
| 'microRegular' | ||
| 'microOblique' | ||
children: ReactNode | ||
color?: string | ||
} | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
applications/launchpad_v2/src/components/TitleBar/TitleBar.test.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
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 was deleted.
Oops, something went wrong.
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
File renamed without changes.