-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathtypes.ts
325 lines (297 loc) · 6.86 KB
/
types.ts
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
import { pick } from "./helpers/utils/object";
import { COLORS, FONTS, FONT_SIZES, FONT_WEIGHTS } from "./theme";
export const TRANSLATION_FIELDS = {
next_slide: "Label for next slide button.",
previous_slide: "Label for previous slide button.",
read_more: "Used on buttons in card grids.",
watch_video: "Label on video play button.",
load_more: "Load more label for pagination.",
blog: "Label for blog article.",
event: "Label for event article.",
casestudy: "Label for casestudy article.",
podcast: "Label for podcast article.",
guide: "Label for guide article.",
tool: "Label for tool article.",
video: "Label for video article.",
newsarticle: "Label for newsarticle article.",
mediacoveragearticle: "Label for mediacoveragearticle article.",
pressrelease: "Label for pressrelease article.",
related_resources: "Label for related article sidebar.",
open: "Label for opening a dropdown.",
};
export type TranslationFieldType = keyof typeof TRANSLATION_FIELDS;
export const PREDEFINED_ICONS = {
arrow: {
title: "Arrow",
description: "Used in buttons",
},
check: {
title: "Check",
description: "Used in check lists",
},
chevrondown: {
title: "Chevron down",
description: "Used in dropdowns, accordions",
},
close: {
title: "Close",
description: "Used to close modals",
},
externallink: {
title: "External link",
description: "Used for external links",
},
lock: {
title: "Lock",
description: "Used for password protected pages",
},
menu: {
title: "Menu",
description: "Used to open the mobile menu",
},
globe: {
title: "Globe",
description: "Shown next to the language selector",
},
home: {
title: "Home",
description: "Shown in the breadcrumb",
},
facebook: {
title: "Facebook",
description: "Shown on the article page share buttons",
},
twitter: {
title: "Twitter",
description: "Shown on the article page share buttons",
},
linkedin: {
title: "LinkedIn",
description: "Shown on the article page share buttons",
},
clipboard: {
title: "Clipboard",
description: "Shown on the article page share buttons",
},
yes: {
title: "Yes",
description: "Icon to show in the pricing comparison table for yes values",
},
no: {
title: "No",
description: "Icon to show in the pricing comparison table for no values",
},
tooltip: {
title: "Tooltip",
description: "Icon to display a tooltip in the pricing comparison table",
},
};
export type PredefinedIconType = keyof typeof PREDEFINED_ICONS;
export type ColorType = keyof typeof COLORS;
export type FontWeightType = keyof typeof FONT_WEIGHTS;
export type FontType = keyof typeof FONTS;
export type FontSizeType = keyof typeof FONT_SIZES;
export type TextElement =
| "h1"
| "h2"
| "h3"
| "h4"
| "h5"
| "span"
| "div"
| "p"
| "figcaption"
| "strong"
| "cite"
| "blockquote";
export const HTML_TEXT_NODES = {
h1: "Heading 1",
h2: "Heading 2",
h3: "Heading 3",
h4: "Heading 4",
h5: "Heading 5",
h6: "Heading 6",
span: "Span",
div: "Div",
};
export const BORDER_RADIUS_OPTIONS = {
none: "none",
sm: "sm",
md: "md",
lg: "lg",
xl: "xl",
"2xl": "2xl",
"3xl": "3xl",
full: "full",
};
export type BorderRadiusType = keyof typeof BORDER_RADIUS_OPTIONS;
export const BORDER_WIDTH_OPTIONS = {
0: "0px",
1: "1px",
2: "2px",
4: "4px",
8: "8px",
};
export type BorderWidthType = keyof typeof BORDER_WIDTH_OPTIONS;
export const TEXT_TRANSFORM_OPTIONS = {
uppercase: "UPPERCASE",
lowercase: "lowercase",
capitalize: "Capitalize",
};
export type TextTransformType = keyof typeof TEXT_TRANSFORM_OPTIONS;
export const PADDING_OPTIONS = {
"0": "0px",
px: "1px",
"0.5": "2px",
"1": "4px",
"1.5": "6px",
"2": "8px",
"2.5": "10px",
"3": "12px",
"3.5": "14px",
"4": "16px",
"5": "20px",
"6": "24px",
"7": "28px",
"8": "32px",
"9": "36px",
"10": "40px",
"11": "44px",
"12": "48px",
"14": "56px",
"16": "64px",
"20": "80px",
"24": "96px",
"28": "112px",
"32": "128px",
"36": "144px",
"40": "160px",
"44": "176px",
"48": "192px",
"52": "208px",
"56": "224px",
"60": "240px",
"64": "256px",
"72": "288px",
"80": "320px",
"96": "384px",
};
export type PaddingType = keyof typeof PADDING_OPTIONS;
export type HtmlTextNodeType = keyof typeof HTML_TEXT_NODES;
export type ImageType = {
src: string;
width?: number;
height?: number;
alt: string;
caption?: string;
crop?: {
_type: "sanity.imageCrop";
bottom: number;
left: number;
right: number;
top: number;
} | null;
hotspot?: {
_type: "sanity.imageHotspot";
height: number;
width: number;
x: number;
y: number;
} | null;
priority?: boolean;
};
export const VIDEO_PROVIDERS = {
youtube: "Youtube",
vimeo: "Vimeo",
mux: "Mux",
sanity: "Sanity",
url: "URL",
};
export type VideoProviderType = keyof typeof VIDEO_PROVIDERS;
export type VideoType = {
loop?: boolean;
caption?: string;
autoPlay?: boolean;
provider?: VideoProviderType;
videoId?: string;
src?: string;
frameless?: boolean;
priority?: boolean;
};
export const SIZES = {
none: "None",
"2xs": "XXS",
xs: "Extra small",
sm: "Small",
md: "Medium",
lg: "Large",
xl: "Extra large",
"2xl": "2XL",
"3xl": "3XL",
"4xl": "4XL",
"5xl": "5XL",
"6xl": "6XL",
};
export type SizeType = keyof typeof SIZES;
export type SizesType = { [key in keyof typeof SIZES]: string };
export const ALIGNMENTS = {
left: "Left",
center: "Center",
right: "Right",
auto: "Auto",
top: "Top",
middle: "Middle",
bottom: "Bottom",
insideLeft: "Inside left",
insideRight: "Inside right",
};
export type AlignmentType = keyof typeof ALIGNMENTS;
export type AlignmentsType = { [key in keyof typeof ALIGNMENTS]: string };
export const HORIZONTAL_ALIGN_OPTIONS = pick(
ALIGNMENTS,
"left",
"center",
"right",
);
export type HorizontalAlignType = keyof typeof HORIZONTAL_ALIGN_OPTIONS;
export const VERTICAL_ALIGN_OPTIONS = pick(
ALIGNMENTS,
"top",
"middle",
"bottom",
);
export type VerticalAlignType = keyof typeof VERTICAL_ALIGN_OPTIONS;
export const RATIOS = {
auto: "Auto",
"1/1": "Square",
"16/9": "16/9",
"9/16": "9/16",
"3/2": "3/2",
"2/3": "2/3",
"2/1": "2/1",
"1/2": "1/2",
"4/3": "4/3",
"3/4": "3/4",
"21/9": "21/9",
"9/21": "9/21",
};
export type RatioType = keyof typeof RATIOS;
export type RatiosType = { [key in keyof typeof RATIOS]: string };
export type PersonType = {
name?: string;
position?: string;
description?: string;
image?: ImageType;
};
export type GenericBlockProps = {
_key: string;
[key: string]: any;
};
export type BlockPreviewToolAction =
| "block-edit"
| "block-delete"
| "block-duplicate"
| "block-move-down"
| "block-move-up"
| "block-add-after";
export type ComponentPreviewToolAction = "component-edit" | "component-delete";