-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathLinkDefinitions.ts
More file actions
154 lines (129 loc) · 4.22 KB
/
LinkDefinitions.ts
File metadata and controls
154 lines (129 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import { FORCED_COLORS_SELECTOR, NOT_FORCED_COLORS_SELECTOR } from './Constants';
// TODO: Temporarily disable dark theme until chat history support dark theme.
const DARK_THEME_SELECTOR = '@media (forced-colors: none) and not (forced-colors: none)'; // Always return false
const LIGHT_THEME_SELECTOR = '@media (forced-colors: none)';
import CSSTokens from '../CSSTokens';
export default function createLinkDefinitionsStyleSet() {
return {
'&.webchat__link-definitions': {
'&[open] .webchat__link-definitions__header::after': {
transform: 'rotate(0deg)'
},
'.webchat__link-definitions__header': {
fontFamily: "Calibri, 'Helvetica Neue', Arial, 'sans-serif'",
fontSize: '80%',
listStyle: 'none',
[LIGHT_THEME_SELECTOR]: {
color: '#616161'
},
[DARK_THEME_SELECTOR]: {
// TODO: Add dark theme color.
color: '#616161'
}
},
'.webchat__link-definitions__header::-webkit-details-marker': {
display: 'none'
},
'&:not([open]) .webchat__link-definitions__header-chevron': {
marginBottom: '-0.1em',
transform: 'rotate(-180deg)'
},
'.webchat__link-definitions__list': {
display: 'flex',
flexDirection: 'column',
gap: 4,
margin: '4px 0 0',
padding: 0
},
'.webchat__link-definitions__list-item': {
display: 'flex', // This prevents the <button> from overflowing. Unsure why "overflow: hidden" doesn't work.
flexDirection: 'column'
},
'.webchat__link-definitions__badge': {
alignItems: 'center',
borderRadius: '4px',
borderStyle: 'solid',
borderWidth: 1,
display: 'flex',
flexShrink: 0,
fontSize: '75%',
justifyContent: 'center',
margin: 4,
minWidth: '1em',
overflow: 'hidden',
padding: 2,
whiteSpace: 'nowrap',
[LIGHT_THEME_SELECTOR]: {
backgroundColor: 'white',
borderColor: '#e0e0e0',
color: 'black'
},
[DARK_THEME_SELECTOR]: {
backgroundColor: 'black',
// TODO: Add dark theme color.
borderColor: '#e0e0e0',
color: 'white'
},
[FORCED_COLORS_SELECTOR]: {
borderColor: 'buttonborder'
}
},
'.webchat__link-definitions__list-item-box': {
alignItems: 'center',
borderRadius: 4,
borderStyle: 'solid',
borderWidth: 1,
[LIGHT_THEME_SELECTOR]: {
backgroundColor: 'white',
borderColor: '#d1d1d1'
},
[DARK_THEME_SELECTOR]: {
backgroundColor: 'black',
// TODO: Add dark theme color.
borderColor: '#d1d1d1'
},
[FORCED_COLORS_SELECTOR]: {
backgroundColor: 'canvas',
borderColor: 'buttonborder'
}
},
'.webchat__link-definitions__list-item-box--as-link': {
display: 'block',
outlineOffset: 0, // This will make sure focus indicator is same as <button>.
textDecoration: 'none'
},
'.webchat__link-definitions__list-item-box--as-button': {
appearance: 'none',
background: 'transparent',
cursor: 'pointer',
fontFamily: 'inherit',
fontSize: 'inherit',
overflow: 'hidden',
padding: 0
},
'.webchat__link-definitions__list-item-body': {
alignItems: 'center',
display: 'flex',
fontFamily: "Calibri, 'Helvetica Neue', Arial, 'sans-serif'",
gap: 4,
padding: 4,
[NOT_FORCED_COLORS_SELECTOR]: {
color: CSSTokens.ColorAccent
}
},
'.webchat__link-definitions__list-item-text': {
overflow: 'hidden',
textDecoration: 'underline',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
[FORCED_COLORS_SELECTOR]: {
color: 'LinkText'
}
},
'.webchat__link-definitions__open-in-new-window-icon': {
flexShrink: 0, // When text is too long, make sure the chevron is not squeezed.
paddingRight: 4 // When text is too long and chevron is on far right, this will align the chevron so it's not too far.
}
}
};
}