File tree Expand file tree Collapse file tree 3 files changed +46
-7
lines changed
Expand file tree Collapse file tree 3 files changed +46
-7
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,31 @@ describe('Text', () => {
1616 expect ( render ( < Text > Content</ Text > ) . getByText ( 'Content' ) ) . toBeInTheDocument ( ) ;
1717 } ) ;
1818
19- it ( 'has a dim color if weak property is set' , ( ) => {
20- expect ( render ( < Text weak /> ) . container . firstChild ) . toHaveStyle ( `
21- color: ${ Colors . AUTHENTIC_BLUE_550 } ;
22- ` ) ;
19+ describe ( 'if the weak property is set' , ( ) => {
20+ it ( 'has a dim color' , ( ) => {
21+ expect ( render ( < Text weak /> ) . container . firstChild ) . toHaveStyle ( `
22+ color: ${ Colors . AUTHENTIC_BLUE_550 } ;
23+ ` ) ;
24+ } ) ;
25+
26+ it ( 'has a dimmer color if inverted' , ( ) => {
27+ expect ( render ( < Text weak inverted /> ) . container . firstChild ) . toHaveStyle ( `
28+ color: ${ Colors . AUTHENTIC_BLUE_350 } ;
29+ ` ) ;
30+ } ) ;
31+ } ) ;
32+
33+ describe ( 'if the disabled property is set' , ( ) => {
34+ it ( 'has the disabled color' , ( ) => {
35+ expect ( render ( < Text disabled /> ) . container . firstChild ) . toHaveStyle ( `
36+ color: ${ Colors . AUTHENTIC_BLUE_350 } ;
37+ ` ) ;
38+ } ) ;
39+ it ( 'has a stronger disabled color if inverted' , ( ) => {
40+ expect ( render ( < Text disabled inverted /> ) . container . firstChild ) . toHaveStyle ( `
41+ color: ${ Colors . AUTHENTIC_BLUE_550 } ;
42+ ` ) ;
43+ } ) ;
2344 } ) ;
2445
2546 it ( 'has a bright color if inverted property is set' , ( ) => {
Original file line number Diff line number Diff line change @@ -35,11 +35,19 @@ interface TextProps
3535 * Adjust color to indicate secondary information
3636 */
3737 weak ?: boolean ;
38+ /**
39+ * Adjust color to display a disabled text element
40+ */
41+ disabled ?: boolean ;
3842}
3943
40- function determineTextColor ( { weak, inverted } : TextProps ) {
41- if ( weak || ( weak && inverted ) ) {
42- return Colors . AUTHENTIC_BLUE_550 ;
44+ function determineTextColor ( { weak, inverted, disabled } : TextProps ) {
45+ if ( disabled ) {
46+ return inverted ? Colors . AUTHENTIC_BLUE_550 : Colors . AUTHENTIC_BLUE_350 ;
47+ }
48+
49+ if ( weak ) {
50+ return inverted ? Colors . AUTHENTIC_BLUE_350 : Colors . AUTHENTIC_BLUE_550 ;
4351 }
4452
4553 if ( inverted ) {
Original file line number Diff line number Diff line change @@ -59,3 +59,13 @@ The Text component is a wrapper component that will apply typography styles to t
5959 <Text as = " p" weak fontSize = { 1 } inverted >paragraph weak inverted medium</Text >
6060 <Text as = " p" weak fontSize = { 0 } inverted >paragraph weak inverted small</Text >
6161</ItemWrapper >
62+ <ItemWrapper >
63+ <Text as = " p" disabled >paragraph disabled large</Text >
64+ <Text as = " p" disabled fontSize = { 1 } >paragraph disabled medium</Text >
65+ <Text as = " p" disabled fontSize = { 0 } >paragraph disabled small</Text >
66+ </ItemWrapper >
67+ <ItemWrapper inverted >
68+ <Text as = " p" disabled inverted >paragraph disabled inverted large</Text >
69+ <Text as = " p" disabled fontSize = { 1 } inverted >paragraph disabled inverted medium</Text >
70+ <Text as = " p" disabled fontSize = { 0 } inverted >paragraph disabled inverted small</Text >
71+ </ItemWrapper >
You can’t perform that action at this time.
0 commit comments