Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 6bb9d80

Browse files
authored
feat(Text): Redlining text component for Teams dark & contrast themes (#317)
* adding in theme background aware doc examples * redlining the themeing for text component in Teams dark and contrast themes * moving 'rtl' up to remove redundant div * moving text color variables to the component until we see a need to have them shared * reordering &renaming text variables * renaming Teams contrast theme variables * reordering styles
1 parent 02fd238 commit 6bb9d80

File tree

8 files changed

+143
-85
lines changed

8 files changed

+143
-85
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { default as Button } from './components/Button/buttonVariables'
2+
export { default as Text } from './components/Text/textVariables'
23
export { default as Divider } from './components/Divider/dividerVariables'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export interface ITextVariables {
2+
atMentionMeColor: string
3+
atMentionOtherColor: string
4+
disabledColor: string
5+
errorColor: string
6+
importantColor: string
7+
successColor: string
8+
timestampColor: string
9+
timestampHoverColor: string
10+
}
11+
12+
export default (siteVariables): ITextVariables => {
13+
return {
14+
atMentionMeColor: siteVariables.orange04,
15+
atMentionOtherColor: siteVariables.brand06,
16+
disabledColor: siteVariables.gray06,
17+
errorColor: siteVariables.red,
18+
importantColor: siteVariables.red,
19+
successColor: siteVariables.green04,
20+
timestampColor: siteVariables.gray04,
21+
timestampHoverColor: siteVariables.gray02,
22+
}
23+
}

src/themes/teams-dark/siteVariables.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
import { white } from '../teams/siteVariables'
1+
import { white, green } from '../teams/siteVariables'
22

33
//
44
// COLORS
55
//
6-
export const black = '#201f1f'
6+
export const black = '#201f1e'
7+
78
export const gray02 = '#c8c6c4'
8-
export const gray03 = '#a6a6a6'
9-
export const gray04 = '#808080'
10-
export const gray06 = '#4d4d4d'
11-
export const gray08 = '#262626'
9+
export const gray03 = '#b3b0ad'
10+
export const gray04 = '#8a8886'
11+
export const gray06 = '#605e5c'
12+
export const gray08 = '#484644'
1213
export const gray09 = '#3b3a39'
13-
export const gray10 = '#2d2c2c'
14-
export const gray14 = '#292828'
14+
export const gray10 = '#323130'
15+
export const gray14 = '#292827'
1516

1617
export const brand = '#6264A7'
1718
export const brand02 = '#e2e2f6'
@@ -27,6 +28,7 @@ export const magenta = '#cf6098'
2728
export const orchid = '#ae3d84'
2829
export const red = '#d74654'
2930
export const red08 = '#4f232b'
31+
export const green04 = green
3032

3133
//
3234
// SEMANTIC ASSIGNMENTS
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export { default as Text } from './components/Text/textVariables'
12
export { default as Divider } from './components/Divider/dividerVariables'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export interface ITextVariables {
2+
atMentionMeColor: string
3+
atMentionOtherColor: string
4+
disabledColor: string
5+
errorColor: string
6+
importantColor: string
7+
successColor: string
8+
timestampColor: string
9+
timestampHoverColor: string
10+
}
11+
12+
export default (siteVariables): ITextVariables => {
13+
return {
14+
atMentionMeColor: siteVariables.accessibleYellow,
15+
atMentionOtherColor: siteVariables.accessibleYellow,
16+
disabledColor: siteVariables.accessibleGreen,
17+
errorColor: siteVariables.red,
18+
importantColor: siteVariables.red,
19+
successColor: siteVariables.green04,
20+
timestampColor: siteVariables.white,
21+
timestampHoverColor: siteVariables.white,
22+
}
23+
}

src/themes/teams-high-contrast/siteVariables.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
import { white } from '../teams/siteVariables'
1+
import { white, green } from '../teams/siteVariables'
22

33
//
44
// COLORS
55
//
66
export const black = '#000'
77

8+
export const accessibleYellow = '#ffff01'
9+
export const accessibleGreen = '#3ff23f'
10+
11+
export const red = '#f00'
12+
export const green04 = green
13+
814
//
915
// SEMANTIC ASSIGNMENTS
1016
//

src/themes/teams/components/Text/textStyles.ts

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,60 +28,62 @@ export default {
2828
return {
2929
...(truncated && truncateStyle),
3030
...(atMention === true && {
31-
color: v.atMentionOtherTextColor,
31+
color: v.atMentionOtherColor,
3232
}),
3333
...(atMention === 'me' && {
34-
color: v.atMentionMeTextColor,
34+
color: v.atMentionMeColor,
3535
fontWeight: v.atMentionMeFontWeight,
3636
}),
37-
...(disabled && { color: v.disabledTextColor }),
38-
...(error && { color: v.errorTextColor }),
39-
...(success && { color: v.successTextColor }),
37+
...(disabled && { color: v.disabledColor }),
38+
...(error && { color: v.errorColor }),
39+
...(success && { color: v.successColor }),
4040
...(temporary && { fontStyle: 'italic' }),
4141
...(timestamp && {
42-
color: v.timestampTextColor,
42+
color: v.timestampColor,
4343
':hover': {
44-
color: v.timestampHoverTextColor,
44+
color: v.timestampHoverColor,
4545
},
4646
}),
47+
...(important && {
48+
fontWeight: v.importantWeight,
49+
color: v.importantColor,
50+
}),
51+
4752
...(weight === Weights.Light && {
48-
fontWeight: v.textWeightLight,
53+
fontWeight: v.fontWeightLight,
4954
}),
5055
...(weight === Weights.Semilight && {
51-
fontWeight: v.textWeightSemilight,
56+
fontWeight: v.fontWeightSemilight,
5257
}),
5358
...(weight === Weights.Regular && {
54-
fontWeight: v.textWeightRegular,
59+
fontWeight: v.fontWeightRegular,
5560
}),
5661
...(weight === Weights.Semibold && {
57-
fontWeight: v.textWeightSemibold,
62+
fontWeight: v.fontWeightSemibold,
5863
}),
5964
...(weight === Weights.Bold && {
60-
fontWeight: v.textWeightBold,
61-
}),
62-
...(important && {
63-
fontWeight: v.importantWeight,
64-
color: v.importantTextColor,
65+
fontWeight: v.fontWeightBold,
6566
}),
67+
6668
...(size === Sizes.Smaller && {
67-
fontSize: v.textExtraSmallFontSize,
68-
lineHeight: v.textExtraSmallLineHeight,
69+
fontSize: v.fontSizeExtraSmall,
70+
lineHeight: v.fontLineHeightExtraSmall,
6971
}),
7072
...(size === Sizes.Small && {
71-
fontSize: v.textSmallFontSize,
72-
lineHeight: v.textSmallLineHeight,
73+
fontSize: v.fontSizeSmall,
74+
lineHeight: v.fontLineHeightSmall,
7375
}),
7476
...(size === Sizes.Medium && {
75-
fontSize: v.textMediumFontSize,
76-
lineHeight: v.textMediumLineHeight,
77+
fontSize: v.fontSizeMedium,
78+
lineHeight: v.fontLineHeightMedium,
7779
}),
7880
...(size === Sizes.Large && {
79-
fontSize: v.textLargeFontSize,
80-
lineHeight: v.textLargeLineHeight,
81+
fontSize: v.fontSizeLarge,
82+
lineHeight: v.fontLineHeightLarge,
8183
}),
8284
...(size === Sizes.Larger && {
83-
fontSize: v.textExtraLargeFontSize,
84-
lineHeight: v.textExtraLargeLineHeight,
85+
fontSize: v.fontSizeExtraLarge,
86+
lineHeight: v.fontLineHeightExtraLarge,
8587
}),
8688
}
8789
},
Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
11
export interface ITextVariables {
2-
importantTextColor: string
3-
importantWeight: number
4-
textWeightLight: number
5-
textWeightSemilight: number
6-
textWeightRegular: number
7-
textWeightSemibold: number
8-
textWeightBold: number
2+
atMentionMeColor: string
93
atMentionMeFontWeight: number
10-
atMentionMeTextColor: string
11-
atMentionOtherTextColor: string
12-
disabledTextColor: string
13-
errorTextColor: string
14-
successTextColor: string
15-
timestampTextColor: string
16-
timestampHoverTextColor: string
17-
textExtraSmallFontSize: string
18-
textExtraSmallLineHeight: number
19-
textSmallFontSize: string
20-
textSmallLineHeight: number
21-
textMediumFontSize: string
22-
textMediumLineHeight: number
23-
textLargeFontSize: string
24-
textLargeLineHeight: number
25-
textExtraLargeFontSize: string
26-
textExtraLargeLineHeight: number
4+
atMentionOtherColor: string
5+
disabledColor: string
6+
errorColor: string
7+
importantColor: string
8+
importantWeight: number
9+
successColor: string
10+
timestampColor: string
11+
timestampHoverColor: string
12+
13+
fontSizeExtraSmall: string
14+
fontLineHeightExtraSmall: number
15+
fontSizeSmall: string
16+
fontLineHeightSmall: number
17+
fontSizeMedium: string
18+
fontLineHeightMedium: number
19+
fontSizeLarge: string
20+
fontLineHeightLarge: number
21+
fontSizeExtraLarge: string
22+
fontLineHeightExtraLarge: number
23+
24+
fontWeightLight: number
25+
fontWeightSemilight: number
26+
fontWeightRegular: number
27+
fontWeightSemibold: number
28+
fontWeightBold: number
2729
}
2830

2931
export default (siteVariables): ITextVariables => {
3032
return {
31-
atMentionOtherTextColor: siteVariables.brand06,
32-
atMentionMeTextColor: siteVariables.orange04,
33+
atMentionOtherColor: siteVariables.brand06,
34+
atMentionMeColor: siteVariables.orange04,
3335
atMentionMeFontWeight: siteVariables.fontWeightBold,
36+
disabledColor: siteVariables.gray06,
37+
errorColor: siteVariables.red,
38+
importantWeight: siteVariables.fontWeightBold,
39+
importantColor: siteVariables.red,
40+
successColor: siteVariables.green04,
41+
timestampColor: siteVariables.gray04,
42+
timestampHoverColor: siteVariables.gray02,
3443

35-
disabledTextColor: siteVariables.gray06,
36-
errorTextColor: siteVariables.red,
37-
successTextColor: siteVariables.green04,
38-
timestampTextColor: siteVariables.gray04,
39-
timestampHoverTextColor: siteVariables.gray02,
40-
41-
textExtraSmallFontSize: siteVariables.fontSizes.smaller,
42-
textExtraSmallLineHeight: siteVariables.lineHeightExtraSmall,
43-
44-
textSmallFontSize: siteVariables.fontSizes.small,
45-
textSmallLineHeight: siteVariables.lineHeightSmall,
44+
fontSizeExtraSmall: siteVariables.fontSizes.smaller,
45+
fontLineHeightExtraSmall: siteVariables.lineHeightExtraSmall,
4646

47-
textMediumFontSize: siteVariables.fontSizes.medium,
48-
textMediumLineHeight: siteVariables.lineHeightBase,
47+
fontSizeSmall: siteVariables.fontSizes.small,
48+
fontLineHeightSmall: siteVariables.lineHeightSmall,
4949

50-
textLargeFontSize: siteVariables.fontSizes.large,
51-
textLargeLineHeight: siteVariables.lineHeightSmall,
50+
fontSizeMedium: siteVariables.fontSizes.medium,
51+
fontLineHeightMedium: siteVariables.lineHeightBase,
5252

53-
textExtraLargeFontSize: siteVariables.fontSizes.larger,
54-
textExtraLargeLineHeight: siteVariables.lineHeightSmall,
53+
fontSizeLarge: siteVariables.fontSizes.large,
54+
fontLineHeightLarge: siteVariables.lineHeightSmall,
5555

56-
importantWeight: siteVariables.fontWeightBold,
57-
importantTextColor: siteVariables.red,
56+
fontSizeExtraLarge: siteVariables.fontSizes.larger,
57+
fontLineHeightExtraLarge: siteVariables.lineHeightSmall,
5858

59-
textWeightLight: siteVariables.fontWeightLight,
60-
textWeightSemilight: siteVariables.fontWeightSemilight,
61-
textWeightRegular: siteVariables.fontWeightRegular,
62-
textWeightSemibold: siteVariables.fontWeightSemibold,
63-
textWeightBold: siteVariables.fontWeightBold,
59+
fontWeightLight: siteVariables.fontWeightLight,
60+
fontWeightSemilight: siteVariables.fontWeightSemilight,
61+
fontWeightRegular: siteVariables.fontWeightRegular,
62+
fontWeightSemibold: siteVariables.fontWeightSemibold,
63+
fontWeightBold: siteVariables.fontWeightBold,
6464
}
6565
}

0 commit comments

Comments
 (0)