-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.ts
158 lines (146 loc) · 5.08 KB
/
data.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
import { prefix } from "../../index.ts";
export const onBackgroundColors = [
"basic-emphasis-100",
"basic-emphasis-90",
"basic-emphasis-80",
"basic-emphasis-70",
"basic-emphasis-60",
"basic-emphasis-50",
];
export const backgroundColors = [
"basic-level-1",
"basic-level-2",
"basic-level-3",
"basic-transparent-semi",
"basic-transparent-full",
];
export const invertedColors = ["contrast-max", "contrast-high", "contrast-low"];
export const colorStates = ["default", "hovered", "pressed"];
export const generateColorProperties = (color: string): string => {
let result = `/* ${color.toUpperCase()} */\n`;
colorStates.forEach((state) => {
backgroundColors.forEach((bgColor) => {
result +=
["-", prefix, color, "bg", bgColor, state].join("-") +
`: "Change the background color level of the current element. Can be used on containers and components.";\n`;
});
onBackgroundColors.forEach((onBgColor) => {
result +=
["-", prefix, color, "on-bg", onBgColor, state].join("-") +
`: "Change the foreground color with another emphasis of the current element.";\n`;
});
invertedColors.forEach((invertedColor) => {
result +=
["-", prefix, color, "bg-inverted", invertedColor, state].join("-") +
`: "Change the background color of the current element. Should be used on single components only.";\n`;
});
result +=
["-", prefix, color, "on-bg", "inverted", state].join("-") +
`: "Change the foreground color of the current element. Only used with inverted background colors.";\n`;
result +=
["-", prefix, color, "origin", state].join("-") +
`: "Origin color can be used for background and foreground. Use this if you know what you are doing, it might not be accessible.";\n`;
result +=
["-", prefix, color, "on-origin", state].join("-") +
`: "Change the foreground color of the current element. Only used with origin as background color.";\n`;
});
return result;
};
export const tShirtSizes: string[] = [
"3xs",
"2xs",
"xs",
"sm",
"md",
"lg",
"xl",
"2xl",
"3xl",
];
export const densities: string[] = ["expressive", "regular", "functional"];
export const dividerPositions = ["top", "bottom", "left", "right"];
export const dividerSlots = ["before", "after"];
const getDividerSizes = () => {
const dSizes: string[] = [];
dividerSlots.forEach((slot) => {
dividerPositions.forEach((position) => {
dSizes.push([position, slot].join("-"));
});
});
return dSizes;
};
export type Variable = {
name: string;
link?: string;
description: string;
sizes: string[];
};
export const allVariables: Variable[] = [
{
name: "sizing",
link: "https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/version-3/foundation/sizing",
description:
"Use sizing's for fixed heights/widths e.g. the db-button has always a fixed height.",
sizes: tShirtSizes,
},
{
name: "spacing-fixed",
description:
"Use fixed spacings for all kind of distances (margin, padding, ...).",
link: "https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/version-3/foundation/spacing",
sizes: tShirtSizes,
},
{
name: "spacing-responsive",
description:
"The primary use-case for responsive spacings are paddings/gaps in an application e.g. the <main> should have a responsive padding.",
link: "https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/version-3/foundation/spacing",
sizes: tShirtSizes,
},
{
name: "elevation",
description: "Changes elevation of element.",
link: "https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/version-3/foundation/elevation",
sizes: ["sm", "md", "lg"],
},
{
name: "border-height",
description: "Changes border-height of element",
link: "https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/version-3/foundation/border-height",
sizes: tShirtSizes,
},
{
name: "border-radius",
description: "Changes border-radius of element",
link: "https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/version-3/foundation/border-radius",
sizes: tShirtSizes,
},
];
export const allClasses: Variable[] = [
{
name: "density",
description: "Use this to change the density of the element.",
sizes: densities,
},
{
name: "focus",
description: "Use this to set default focus outline.",
sizes: ["default"],
},
{
name: "divider",
description: "Use this to add a divider as :before or :after element.",
sizes: getDividerSizes(),
},
{
name: "bg-color",
description: "Change the background color level of the current element.",
sizes: backgroundColors,
},
{
name: "on-bg-color",
description:
"Change the foreground color with another emphasis of the current element.",
sizes: onBackgroundColors,
},
];