sforkowany z mirror/soapbox
Add 'transform' prop to Text
rodzic
f625e13a25
commit
b7e9015dfd
|
@ -6,6 +6,7 @@ type Weights = 'normal' | 'medium' | 'semibold' | 'bold'
|
||||||
type Sizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'
|
type Sizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'
|
||||||
type Alignments = 'left' | 'center' | 'right'
|
type Alignments = 'left' | 'center' | 'right'
|
||||||
type TrackingSizes = 'normal' | 'wide'
|
type TrackingSizes = 'normal' | 'wide'
|
||||||
|
type TransformProperties = 'uppercase' | 'normal'
|
||||||
type Families = 'sans' | 'mono'
|
type Families = 'sans' | 'mono'
|
||||||
type Tags = 'abbr' | 'p' | 'span' | 'pre' | 'time' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
type Tags = 'abbr' | 'p' | 'span' | 'pre' | 'time' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
||||||
|
|
||||||
|
@ -48,6 +49,11 @@ const trackingSizes = {
|
||||||
wide: 'tracking-wide',
|
wide: 'tracking-wide',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const transformProperties = {
|
||||||
|
normal: 'normal-case',
|
||||||
|
uppercase: 'uppercase',
|
||||||
|
};
|
||||||
|
|
||||||
const families = {
|
const families = {
|
||||||
sans: 'font-sans',
|
sans: 'font-sans',
|
||||||
mono: 'font-mono',
|
mono: 'font-mono',
|
||||||
|
@ -62,6 +68,7 @@ interface IText extends Pick<React.HTMLAttributes<HTMLParagraphElement>, 'danger
|
||||||
tag?: Tags,
|
tag?: Tags,
|
||||||
theme?: Themes,
|
theme?: Themes,
|
||||||
tracking?: TrackingSizes,
|
tracking?: TrackingSizes,
|
||||||
|
transform?: TransformProperties,
|
||||||
truncate?: boolean,
|
truncate?: boolean,
|
||||||
weight?: Weights
|
weight?: Weights
|
||||||
}
|
}
|
||||||
|
@ -76,6 +83,7 @@ const Text: React.FC<IText> = React.forwardRef(
|
||||||
tag = 'p',
|
tag = 'p',
|
||||||
theme = 'default',
|
theme = 'default',
|
||||||
tracking = 'normal',
|
tracking = 'normal',
|
||||||
|
transform = 'normal',
|
||||||
truncate = false,
|
truncate = false,
|
||||||
weight = 'normal',
|
weight = 'normal',
|
||||||
...filteredProps
|
...filteredProps
|
||||||
|
@ -99,6 +107,7 @@ const Text: React.FC<IText> = React.forwardRef(
|
||||||
[trackingSizes[tracking]]: true,
|
[trackingSizes[tracking]]: true,
|
||||||
[families[family]]: true,
|
[families[family]]: true,
|
||||||
[alignmentClass]: typeof align !== 'undefined',
|
[alignmentClass]: typeof align !== 'undefined',
|
||||||
|
[transformProperties[transform]]: typeof transform !== 'undefined',
|
||||||
}, className)}
|
}, className)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
Ładowanie…
Reference in New Issue