-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(component): add text modifiers to typography (#240)
- Loading branch information
Showing
8 changed files
with
254 additions
and
33 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import React from 'react'; | ||
|
||
import { Small, SmallProps } from '../../Typography'; | ||
import { Small, TextProps } from '../../Typography'; | ||
|
||
export const Error: React.FC<SmallProps> = ({ className, style, ...props }) => ( | ||
export const Error: React.FC<TextProps> = ({ className, style, ...props }) => ( | ||
<Small color="danger" margin="none" marginLeft="xxSmall" {...props} /> | ||
); |
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import { HeadingProps as _HeadingProps, SmallProps as _SmallProps, TextProps as _TextProps } from './Typography'; | ||
import { HeadingProps as _HeadingProps, TextProps as _TextProps } from './types'; | ||
|
||
export { Text, Small, H0, H1, H2, H3, H4 } from './Typography'; | ||
|
||
export type TextProps = _TextProps; | ||
export type SmallProps = _SmallProps; | ||
export type HeadingProps = _HeadingProps; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Colors, ThemeInterface } from '@bigcommerce/big-design-theme'; | ||
import React from 'react'; | ||
|
||
import { MarginProps } from '../../mixins'; | ||
|
||
export interface TypographyProps { | ||
color?: keyof Colors; | ||
ellipsis?: boolean; | ||
theme?: ThemeInterface; | ||
} | ||
|
||
export interface TextModifiers { | ||
bold?: boolean; | ||
italic?: boolean; | ||
strikethrough?: boolean; | ||
underline?: boolean; | ||
} | ||
|
||
export type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; | ||
export type TextTag = | ||
| 'abbr' | ||
| 'b' | ||
| 'bdi' | ||
| 'bdo' | ||
| 'blockquote' | ||
| 'caption' | ||
| 'cite' | ||
| 'code' | ||
| 'em' | ||
| 'figcaption' | ||
| 'i' | ||
| 'label' | ||
| 'legend' | ||
| 'p' | ||
| 'pre' | ||
| 'q' | ||
| 's' | ||
| 'small' | ||
| 'span' | ||
| 'strong' | ||
| 'title'; | ||
|
||
export type TextProps = React.HTMLAttributes<HTMLParagraphElement> & | ||
MarginProps & | ||
TypographyProps & | ||
TextModifiers & { | ||
as?: TextTag; | ||
}; | ||
|
||
export type HeadingProps = React.HTMLAttributes<HTMLHeadingElement> & | ||
MarginProps & | ||
TypographyProps & { | ||
as?: HeadingTag; | ||
}; |
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.