@@ -7,21 +7,14 @@ import {
77 TextColors ,
88 Theme ,
99} from '../../theme/ThemeInterface' ;
10+ import { TextAlign , TextTransform } from './types' ;
1011
1112export interface TextSizes {
1213 small : TextStyle ;
1314 medium : TextStyle ;
1415 large : TextStyle ;
1516}
1617
17- export interface ColorVariations {
18- lightest : string ;
19- light : string ;
20- base : string ;
21- dark : string ;
22- darkest : string ;
23- }
24-
2518export type TextSize = keyof TextSizes ;
2619
2720export interface TextVariables {
@@ -33,10 +26,6 @@ export interface TextVariables {
3326export const getTextVariables = ( theme : Theme ) : TextVariables => {
3427 return {
3528 size : {
36- /**
37- * It's useful to have xlarge because `Link` uses the `Text` component.
38- * A `Link` could be used as xlarge in the context of a breadcrumb.
39- */
4029 large : {
4130 fontSize : theme . textSizes . large ,
4231 fontWeight : '400' ,
@@ -66,9 +55,12 @@ export const getTextVariables = (theme: Theme): TextVariables => {
6655} ;
6756
6857export interface TextStylesProps {
69- bold : boolean ;
58+ isBold : boolean ;
59+ isItalic : boolean ;
7060 size : TextSize ;
7161 color : TextColor ;
62+ align : TextAlign ;
63+ transform ?: TextTransform ;
7264 fontFamily : FontFamily ;
7365 isInline : boolean ;
7466}
@@ -90,7 +82,7 @@ export const getTextColor = (textColors: TextColors) => (
9082) => textColors [ textColor ] ;
9183
9284export const getTextStyles : GetTextStyles = (
93- { size, color, fontFamily, isInline, bold } ,
85+ { size, color, fontFamily, isInline, isBold , isItalic , align , transform } ,
9486 theme ,
9587) => {
9688 const textVariables = getTextVariables ( theme ) ;
@@ -99,16 +91,23 @@ export const getTextStyles: GetTextStyles = (
9991 textStyle : {
10092 color : getTextColor ( textVariables . color ) ( color ) ,
10193 fontFamily : getFontFamily ( textVariables . fontFamily ) ( fontFamily ) ,
94+ textAlign : align ,
10295 ...( isInline
10396 ? {
10497 alignSelf : 'flex-start' ,
10598 flexDirection : 'row' ,
10699 }
107100 : { } ) ,
108101 ...textVariables . size [ size ] ,
109- ...( bold && {
102+ ...( isBold && {
110103 fontWeight : '600' ,
111104 } ) ,
105+ ...( isItalic && {
106+ fontStyle : 'italic' ,
107+ } ) ,
108+ ...( transform && {
109+ textTransform : transform ,
110+ } ) ,
112111 } ,
113112 } ;
114113} ;
0 commit comments