Skip to content

Commit b31d917

Browse files
committed
feat(ui-text,shared-types): add ai-highlight color
INSTUI-4547
1 parent a00690b commit b31d917

File tree

5 files changed

+41
-28
lines changed

5 files changed

+41
-28
lines changed

packages/shared-types/src/ComponentThemeVariables.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,15 +1398,18 @@ export type TagTheme = {
13981398
}
13991399

14001400
export type TextTheme = Typography & {
1401-
primaryInverseColor: Colors['contrasts']['white1010']
1402-
primaryColor: Colors['contrasts']['grey125125']
1403-
secondaryColor: Colors['contrasts']['grey4570']
1404-
secondaryInverseColor: Colors['contrasts']['grey1111']
1405-
brandColor: Colors['contrasts']['blue4570']
1406-
dangerColor: Colors['contrasts']['red4570']
1407-
successColor: Colors['contrasts']['green4570']
1408-
alertColor: Colors['contrasts']['blue4570']
1409-
warningColor: Colors['contrasts']['orange5782']
1401+
primaryInverseColor: string
1402+
primaryColor: string
1403+
secondaryColor: string
1404+
secondaryInverseColor: string
1405+
brandColor: string
1406+
dangerColor: string
1407+
successColor: string
1408+
alertColor: string
1409+
warningColor: string
1410+
aiColor: string
1411+
1412+
aiBackgroundColor: string
14101413
paragraphMargin: string | 0
14111414
}
14121415

packages/ui-text/src/Text/README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ type: example
2626
</div>
2727
```
2828

29+
### Text colors
30+
31+
```js
32+
---
33+
type: example
34+
---
35+
<div>
36+
<Text color="primary">I&#39;m primary text</Text><br/>
37+
<Text color="secondary">I&#39;m secondary text</Text><br/>
38+
<Text color="brand">I&#39;m brand text</Text><br />
39+
<Text color="success">I&#39;m success text</Text><br/>
40+
<Text color="warning">I&#39;m warning text</Text><br />
41+
<Text color="danger">I&#39;m danger text</Text><br />
42+
<Text color="ai-highlight">I&#39;m a highlighted text (by AI)</Text><br />
43+
<Text color="alert">I&#39;m alert text - DEPRECATED - DO NOT USE</Text>
44+
</div>
45+
```
46+
2947
### Font sizes
3048

3149
```js
@@ -134,23 +152,6 @@ type: example
134152
</div>
135153
```
136154

137-
### Text colors
138-
139-
```js
140-
---
141-
type: example
142-
---
143-
<div>
144-
<Text color="primary">I&#39;m primary text</Text><br/>
145-
<Text color="secondary">I&#39;m secondary text</Text><br/>
146-
<Text color="brand">I&#39;m brand text</Text><br />
147-
<Text color="success">I&#39;m success text</Text><br/>
148-
<Text color="warning">I&#39;m warning text</Text><br />
149-
<Text color="danger">I&#39;m danger text</Text><br />
150-
<Text color="alert">I&#39;m alert text - DEPRECATED - DO NOT USE</Text>
151-
</div>
152-
```
153-
154155
```js
155156
---
156157
type: example

packages/ui-text/src/Text/props.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type TextOwnProps = {
5252
| 'warning'
5353
| 'primary-inverse'
5454
| 'secondary-inverse'
55+
| 'ai-highlight'
5556
/**
5657
* Provides a reference to the underlying HTML element
5758
*/
@@ -119,7 +120,8 @@ const propTypes: PropValidators<PropKeys> = {
119120
'warning',
120121
'alert',
121122
'primary-inverse',
122-
'secondary-inverse'
123+
'secondary-inverse',
124+
'ai-highlight'
123125
]),
124126
elementRef: PropTypes.func,
125127
fontStyle: PropTypes.oneOf(['italic', 'normal']),

packages/ui-text/src/Text/styles.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ const generateStyle = (
105105
brand: { color: componentTheme.brandColor },
106106
danger: { color: componentTheme.dangerColor },
107107
alert: { color: componentTheme.alertColor },
108-
warning: { color: componentTheme.warningColor }
108+
warning: { color: componentTheme.warningColor },
109+
'ai-highlight': {
110+
color: componentTheme.aiColor,
111+
background: componentTheme.aiBackgroundColor
112+
}
109113
}
110114

111115
const wrapStyle = {

packages/ui-text/src/Text/theme.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ const generateComponentTheme = (theme: Theme): TextTheme => {
5454
successColor: colors?.contrasts?.green5782,
5555
alertColor: colors?.contrasts?.blue5782,
5656
warningColor: colors?.contrasts?.orange5782,
57+
aiColor: colors?.contrasts?.violet5790,
58+
59+
aiBackgroundColor: colors?.contrasts?.violet1212,
5760

5861
paragraphMargin: `${spacing.medium} 0`
5962
}

0 commit comments

Comments
 (0)