Skip to content

Commit a00690b

Browse files
committed
feat(ui-heading,shared-types): add ai color
INSTUI-4550
1 parent 47868fc commit a00690b

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

packages/shared-types/src/ComponentThemeVariables.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -662,14 +662,16 @@ export type HeadingTheme = Typography & {
662662
h5FontSize: Typography['fontSizeSmall']
663663
h5FontWeight: Typography['fontWeightNormal']
664664
h5FontFamily: Typography['fontFamily']
665-
primaryInverseColor: Colors['contrasts']['white1010']
666-
primaryColor: Colors['contrasts']['grey125125']
667-
secondaryColor: Colors['contrasts']['grey4570']
668-
secondaryInverseColor: Colors['contrasts']['grey1111']
665+
primaryInverseColor: string
666+
primaryColor: string
667+
secondaryColor: string
668+
secondaryInverseColor: string
669669
borderPadding: Spacing['xxxSmall']
670-
borderColor: Colors['contrasts']['grey1424']
670+
borderColor: string
671671
borderWidth: Border['widthSmall']
672672
borderStyle: Border['style']
673+
aiTextTopGradientColor: string
674+
aiTextBottomGradientColor: string
673675
}
674676

675677
export type ImgTheme = {

packages/ui-heading/src/Heading/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ type: example
6565
<Heading>I inherit my color via the CSS cascade (default)</Heading>
6666
<Heading color="primary">I am primary color</Heading>
6767
<Heading color="secondary">I am secondary color</Heading>
68+
<Heading color="ai"><IconAiColoredSolid/>&nbsp; I am AI color</Heading>
6869
</div>
6970
```
7071

packages/ui-heading/src/Heading/props.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type HeadingOwnProps = {
5858
| 'primary-inverse'
5959
| 'secondary-inverse'
6060
| 'inherit'
61+
| 'ai'
6162
/**
6263
* The *visual* appearance of the Heading: h1 is largest; h5 is smallest.
6364
*/
@@ -112,7 +113,8 @@ const propTypes: PropValidators<PropKeys> = {
112113
'secondary',
113114
'primary-inverse',
114115
'secondary-inverse',
115-
'inherit'
116+
'inherit',
117+
'ai'
116118
]),
117119
level: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'reset']),
118120
as: PropTypes.elementType,

packages/ui-heading/src/Heading/styles.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,13 @@ const generateStyle = (
143143
primary: { color: componentTheme.primaryColor },
144144
secondary: { color: componentTheme.secondaryColor },
145145
'primary-inverse': { color: componentTheme.primaryInverseColor },
146-
'secondary-inverse': { color: componentTheme.secondaryInverseColor }
146+
'secondary-inverse': { color: componentTheme.secondaryInverseColor },
147+
ai: {
148+
background: `
149+
linear-gradient(to bottom, ${componentTheme.aiTextTopGradientColor} 0%, ${componentTheme.aiTextBottomGradientColor} 100%) text`,
150+
border: 'solid transparent',
151+
WebkitTextFillColor: 'transparent'
152+
}
147153
}
148154

149155
const borderStyles = {
@@ -182,6 +188,8 @@ const generateStyle = (
182188
label: 'heading',
183189
lineHeight: componentTheme.lineHeight,
184190
margin: 0,
191+
display: 'flex',
192+
alignItems: 'center',
185193

186194
// NOTE: the input styles exist to accommodate the InPlaceEdit component
187195
// NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)

packages/ui-heading/src/Heading/theme.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ const generateComponentTheme = (theme: Theme): HeadingTheme => {
8383
borderPadding: spacing?.xxxSmall,
8484
borderColor: colors?.contrasts?.grey1424,
8585
borderWidth: borders?.widthSmall,
86-
borderStyle: borders?.style
86+
borderStyle: borders?.style,
87+
88+
aiTextTopGradientColor: colors.contrasts.violet4570,
89+
aiTextBottomGradientColor: colors.contrasts.sea4570
8790
}
8891

8992
return {

0 commit comments

Comments
 (0)