Skip to content

Commit 2eabd18

Browse files
fix: replace hardcoded css with vars (#727)
fix: replace hardcoded css with css vars
1 parent e741c21 commit 2eabd18

34 files changed

Lines changed: 196 additions & 165 deletions

packages/raystack/components/accordion/accordion.module.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
.accordion-trigger {
1111
display: flex;
12+
/* Todo: var does not exist for 36px */
1213
min-height: 36px;
1314
padding: 0 var(--rs-space-4);
1415
justify-content: space-between;
@@ -25,6 +26,7 @@
2526
line-height: var(--rs-line-height-regular);
2627
letter-spacing: var(--rs-letter-spacing-regular);
2728
}
29+
2830
.accordion-item:not(:first-child) .accordion-trigger {
2931
border-top: none;
3032
}
@@ -76,4 +78,4 @@
7678
align-self: stretch;
7779
padding: var(--rs-space-5) var(--rs-space-4);
7880
border-top: 0px;
79-
}
81+
}

packages/raystack/components/announcement-bar/announcement-bar.module.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.announcement-bar {
22
width: 100%;
3-
min-height: 40px;
3+
min-height: var(--rs-space-10);
44
padding: var(--rs-space-3) var(--rs-space-7);
55
}
66

@@ -36,8 +36,8 @@
3636

3737
.icon,
3838
.icon > svg {
39-
min-height: 16px;
40-
min-width: 16px;
39+
min-height: var(--rs-space-5);
40+
min-width: var(--rs-space-5);
4141
}
4242

4343
.action-btn {

packages/raystack/components/badge/badge.module.css

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,23 @@
1515
font-size: var(--rs-font-size-micro);
1616
line-height: var(--rs-line-height-micro);
1717
letter-spacing: var(--rs-letter-spacing-micro);
18+
/* Todo: var does not exist for 18px */
1819
height: 18px;
1920
}
2021

2122
.badge-small {
2223
font-size: var(--rs-font-size-small);
2324
line-height: var(--rs-line-height-small);
2425
letter-spacing: var(--rs-letter-spacing-small);
26+
/* Todo: var does not exist for 22px */
2527
height: 22px;
2628
}
2729

2830
.badge-regular {
2931
font-size: var(--rs-font-size-regular);
3032
line-height: var(--rs-line-height-regular);
3133
letter-spacing: var(--rs-letter-spacing-regular);
32-
height: 28px;
34+
height: var(--rs-space-8);
3335
}
3436

3537
/* Variants */
@@ -72,22 +74,25 @@
7274
}
7375

7476
.badge-micro .icon {
77+
/* Todo: var does not exist for 10px */
7578
width: 10px;
7679
height: 10px;
7780
}
7881

7982
.badge-small .icon {
80-
width: 12px;
81-
height: 12px;
83+
width: var(--rs-space-4);
84+
height: var(--rs-space-4);
8285
}
8386

8487
.badge-regular .icon {
88+
/* Todo: var does not exist for 14px */
8589
width: 14px;
8690
height: 14px;
8791
}
8892

8993
.sr-only {
9094
position: absolute;
95+
/* Todo: var does not exist for 1px */
9196
width: 1px;
9297
height: 1px;
9398
padding: 0;
@@ -96,4 +101,4 @@
96101
clip: rect(0, 0, 0, 0);
97102
white-space: nowrap;
98103
border: 0;
99-
}
104+
}

packages/raystack/components/button/button.module.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
}
1818

1919
.button:focus-visible {
20+
/* Todo: var does not exist for 1px */
2021
outline: 1px solid var(--rs-color-border-accent-emphasis);
2122
}
23+
2224
.button:focus {
2325
outline: none;
2426
}
@@ -245,9 +247,10 @@
245247
}
246248

247249
.loader {
248-
border: 2px solid var(--rs-color-background-base-primary);
249-
border-top: 2px solid var(--rs-color-foreground-base-primary);
250+
border: var(--rs-space-1) solid var(--rs-color-background-base-primary);
251+
border-top: var(--rs-space-1) solid var(--rs-color-foreground-base-primary);
250252
border-radius: 50%;
253+
/* Todo: var does not exist for 10px */
251254
width: 10px;
252255
height: 10px;
253256
animation: spin 1s linear infinite;
@@ -597,4 +600,4 @@
597600
.button-text-success:disabled:hover,
598601
.button-text-success.button-loading:hover {
599602
color: var(--rs-color-foreground-success-primary);
600-
}
603+
}

packages/raystack/components/calendar/calendar.module.css

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
border-radius: var(--rs-radius-4);
44
background: var(--rs-color-background-base-primary);
55
width: fit-content;
6+
/* Todo: var does not exist for 346px */
67
min-height: 346px;
78
}
89

910
.captionLabel,
10-
.dropdowns > span,
11+
.dropdowns>span,
1112
.dropdown_trigger {
1213
font-weight: var(--rs-font-weight-medium);
1314
font-size: var(--rs-font-size-mini);
@@ -26,6 +27,7 @@
2627
.navButton {
2728
position: absolute;
2829
top: 0;
30+
/* Todo: var does not exist for 0px */
2931
border: 0px;
3032
color: var(--rs-color-foreground-base-primary);
3133
background: var(--rs-color-background-base-primary);
@@ -82,7 +84,7 @@
8284
display: flex;
8385
justify-content: center;
8486
align-items: center;
85-
border: 1px solid transparent;
87+
border: var(--rs-space-1) solid transparent;
8688
margin-bottom: var(--rs-space-1);
8789
}
8890

@@ -91,7 +93,7 @@
9193
height: var(--rs-space-10, 40px);
9294
flex-shrink: 0;
9395
border-radius: var(--rs-radius-5);
94-
border: 1px solid var(--rs-color-border-accent-emphasis-hover);
96+
border: var(--rs-space-1) solid var(--rs-color-border-accent-emphasis-hover);
9597
background-color: transparent;
9698
}
9799

@@ -170,7 +172,7 @@
170172

171173
.calendarPopover {
172174
padding: var(--rs-space-3) !important;
173-
/* border: none !important; */
175+
/* Todo: var does not exist for 0.5px */
174176
border: 0.5px solid var(--rs-color-border-base-primary) !important;
175177
min-width: max-content;
176178
width: fit-content;
@@ -250,7 +252,7 @@
250252

251253
.dayInfo {
252254
position: absolute;
253-
top: -2px;
255+
top: calc(-1 * var(--rs-space-1));
254256
left: 50%;
255257
transform: translateX(-50%);
256258
display: flex;
@@ -290,4 +292,4 @@
290292

291293
.datePickerInput {
292294
text-align: left;
293-
}
295+
}

packages/raystack/components/callout/callout.module.css

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.callout {
22
position: relative;
3+
/* Todo: var does not exist for 318px */
34
width: 318px;
45
padding: var(--rs-space-3);
56
border-radius: var(--rs-radius-2);
@@ -8,6 +9,7 @@
89
font-size: var(--rs-font-size-small);
910
line-height: var(--rs-line-height-small);
1011
letter-spacing: var(--rs-letter-spacing-small);
12+
/* Todo: var does not exist for 0.5px */
1113
border: 0.5px solid transparent;
1214
}
1315

@@ -16,7 +18,7 @@
1618
justify-content: space-between;
1719
align-items: center;
1820
width: 100%;
19-
gap: 40px;
21+
gap: var(--rs-space-10);
2022
}
2123

2224
.messageContainer {
@@ -30,8 +32,8 @@
3032
display: flex;
3133
align-items: center;
3234
justify-content: center;
33-
width: 16px;
34-
height: 16px;
35+
width: var(--rs-space-5);
36+
height: var(--rs-space-5);
3537
flex-shrink: 0;
3638
color: currentColor;
3739
}
@@ -80,8 +82,9 @@
8082
}
8183

8284
.callout-success {
85+
/* Todo: var does not exist for 318px */
8386
width: 318px;
84-
gap: 40px;
87+
gap: var(--rs-space-10);
8588
background: var(--rs-color-background-success-primary);
8689
color: var(--rs-color-foreground-success-primary);
8790
}
@@ -113,6 +116,7 @@
113116

114117
.callout-outline.callout-grey {
115118
background: var(--rs-color-background-neutral-primary);
119+
/* Todo: var does not exist for 0.5px */
116120
border: 0.5px solid var(--rs-color-border-base-primary);
117121
}
118122

@@ -239,4 +243,4 @@
239243
background: var(--rs-color-background-base-primary);
240244
border: 0.5px solid var(--rs-color-border-base-tertiary);
241245
color: var(--rs-color-foreground-base-primary);
242-
}
246+
}

packages/raystack/components/checkbox/checkbox.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@
6868
.icon {
6969
width: var(--rs-space-5);
7070
height: var(--rs-space-5);
71-
}
71+
}

packages/raystack/components/chip/chip.module.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@
111111
display: inline-flex;
112112
align-items: center;
113113
justify-content: center;
114-
width: 12px;
115-
height: 12px;
114+
width: var(--rs-space-4);
115+
height: var(--rs-space-4);
116116
}
117117

118118
.dismiss-button {
@@ -124,4 +124,4 @@
124124
display: inline-flex;
125125
align-items: center;
126126
justify-content: center;
127-
}
127+
}

packages/raystack/components/code-block/code.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@
9191
}
9292

9393
.theme :global(.token.important) {
94-
font-weight: 500;
94+
font-weight: var(--rs-font-weight-medium);
9595
}
9696

9797
.theme :global(.token.bold) {
98-
font-weight: 500;
98+
font-weight: var(--rs-font-weight-medium);
9999
}
100100

101101
.theme :global(.token.italic) {

packages/raystack/components/color-picker/color-picker.module.css

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,47 @@
66
user-select: none;
77
align-items: center;
88
}
9+
910
.sliderControl {
1011
display: flex;
1112
align-items: center;
1213
width: 100%;
1314
}
15+
1416
.sliderRange {
1517
position: absolute;
1618
height: 100%;
1719
border-radius: var(--rs-radius-full);
1820
background: transparent;
1921
}
22+
2023
.sliderTrack {
2124
position: relative;
22-
height: 12px;
25+
height: var(--rs-space-4);
2326
width: 100%;
2427
flex-grow: 1;
2528
border-radius: var(--rs-radius-3);
2629
}
30+
2731
.hueTrack {
28-
background: linear-gradient(
29-
90deg,
30-
#ff0000,
31-
#ffff00,
32-
#00ff00,
33-
#00ffff,
34-
#0000ff,
35-
#ff00ff,
36-
#ff0000
37-
);
32+
background: linear-gradient(90deg,
33+
#ff0000,
34+
#ffff00,
35+
#00ff00,
36+
#00ffff,
37+
#0000ff,
38+
#ff00ff,
39+
#ff0000);
3840
}
3941

4042
.sliderThumb {
4143
position: absolute;
4244
display: block;
43-
height: 12px;
44-
width: 12px;
45+
height: var(--rs-space-4);
46+
width: var(--rs-space-4);
4547
border-radius: var(--rs-radius-full);
4648
border: 3px solid var(--rs-color-foreground-base-emphasis);
47-
filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.02))
48-
drop-shadow(0px 1px 1px rgba(0, 0, 0, 0.06));
49+
filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.02)) drop-shadow(0px 1px 1px rgba(0, 0, 0, 0.06));
4950
}
5051

5152
.sliderThumb:focus-visible {
@@ -58,21 +59,20 @@
5859
}
5960

6061
.alphaTrack {
61-
--track-checker-size: 12px;
62+
--track-checker-size: var(--rs-space-4);
6263
background-image:
6364
linear-gradient(45deg, #ddd 25%, transparent 25%),
6465
linear-gradient(-45deg, #ddd 25%, transparent 25%),
6566
linear-gradient(45deg, transparent 75%, #ddd 75%),
6667
linear-gradient(-45deg, transparent 75%, #ddd 75%);
67-
background-size: var(--track-checker-size, 8px)
68-
var(--track-checker-size, 12px);
68+
background-size: var(--track-checker-size, 8px) var(--track-checker-size, 12px);
6969
background-position:
7070
0 0,
7171
0 calc(var(--track-checker-size, 12px) / 2),
72-
calc(var(--track-checker-size, 12px) / 2)
73-
calc(var(--track-checker-size, 12px) / -2),
72+
calc(var(--track-checker-size, 12px) / 2) calc(var(--track-checker-size, 12px) / -2),
7473
calc(var(--track-checker-size, 12px) / -2) 0px;
7574
}
75+
7676
.alphaTrackGradient {
7777
position: absolute;
7878
inset: 0;

0 commit comments

Comments
 (0)