File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,14 @@ const meta: Meta<typeof Tag> = {
5757 edit,
5858 } ,
5959 } ,
60+ iconColor : {
61+ control : 'color' ,
62+ type : 'string' ,
63+ } ,
64+ textColor : {
65+ control : 'color' ,
66+ type : 'string' ,
67+ } ,
6068 } ,
6169 args : {
6270 color : 'purple' ,
@@ -104,6 +112,16 @@ export const Colors: Story = {
104112 ) ,
105113} ;
106114
115+ export const CustomTextAndIconColors : Story = {
116+ args : {
117+ leadingIcon : code ,
118+ color : 'pink' ,
119+ children : 'Developer' ,
120+ textColor : '#265c36' ,
121+ iconColor : '#33C1FF' ,
122+ } ,
123+ } ;
124+
107125export const LeadingIcon : Story = {
108126 tags : [ 'test-only' ] ,
109127 args : {
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import styled from 'styled-components';
1010
1111interface ContainerProps {
1212 $color : NonNullable < TagProps [ 'color' ] > ;
13+ $iconColor ?: string ;
14+ $textColor ?: string ;
1315}
1416
1517const Container = styled . div < ContainerProps > `
@@ -21,11 +23,11 @@ const Container = styled.div<ContainerProps>`
2123 background: ${ ( { $color } ) => TAG_COLORS [ $color ] . background } ;
2224 min-height: 24px;
2325 > span {
24- color: ${ ( { $color } ) => TAG_COLORS [ $color ] . text } ;
26+ color: ${ ( { $color, $textColor } ) => $textColor ?? TAG_COLORS [ $color ] . text } ;
2527 line-height: normal;
2628 }
2729 > svg {
28- fill: ${ ( { $color } ) => TAG_COLORS [ $color ] . text } ;
30+ fill: ${ ( { $color, $iconColor } ) => $iconColor ?? TAG_COLORS [ $color ] . text } ;
2931 }
3032` ;
3133
@@ -41,6 +43,8 @@ export interface TagProps {
4143 | 'grey' ;
4244 leadingIcon ?: IconData ;
4345 trailingIcon ?: IconData ;
46+ iconColor ?: string ;
47+ textColor ?: string ;
4448 children : string ;
4549}
4650
@@ -49,9 +53,11 @@ export const Tag: FC<TagProps> = ({
4953 color = 'blue' ,
5054 leadingIcon,
5155 trailingIcon,
56+ textColor,
57+ iconColor,
5258} ) => {
5359 return (
54- < Container $color = { color } >
60+ < Container $color = { color } $iconColor = { iconColor } $textColor = { textColor } >
5561 { leadingIcon && < Icon data = { leadingIcon } size = { 16 } /> }
5662 < Typography variant = "cell_text" group = "table" as = "span" >
5763 { children }
You can’t perform that action at this time.
0 commit comments