Skip to content

Commit a26720a

Browse files
committed
refactor: text module 스타일 반복 간소화
1 parent 7951b46 commit a26720a

File tree

1 file changed

+33
-85
lines changed

1 file changed

+33
-85
lines changed

src/components/ui/Text/Text.module.scss

Lines changed: 33 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,37 @@
11
.Text {
2-
&.color-white {
3-
color: var(--color-text-white);
4-
}
5-
6-
&.color-black {
7-
color: var(--color-text-black);
8-
}
9-
10-
&.color-primary {
11-
color: var(--color-text-primary);
12-
}
13-
14-
&.color-secondary {
15-
color: var(--color-text-secondary);
16-
}
17-
18-
&.color-tertiary {
19-
color: var(--color-text-tertiary);
20-
}
21-
22-
&.color-quarternary {
23-
color: var(--color-text-quarternary);
24-
}
25-
26-
&.color-gradient {
27-
background: var(--color-text-gradient);
28-
-webkit-background-clip: text;
29-
background-clip: text;
30-
-webkit-text-fill-color: transparent;
31-
}
32-
33-
&.size-xxs {
34-
font-size: var(--font-size-xxs);
35-
}
36-
37-
&.size-xs {
38-
font-size: var(--font-size-xs);
39-
}
40-
41-
&.size-sm {
42-
font-size: var(--font-size-sm);
43-
}
44-
45-
&.size-default {
46-
font-size: var(--font-size-default);
47-
}
48-
49-
&.size-md {
50-
font-size: var(--font-size-md);
51-
}
52-
53-
&.size-lg {
54-
font-size: var(--font-size-lg);
55-
}
56-
57-
&.size-xl {
58-
font-size: var(--font-size-xl);
59-
}
60-
61-
&.weight-regular {
62-
font-weight: var(--font-weight-regular);
63-
}
64-
65-
&.weight-medium {
66-
font-weight: var(--font-weight-medium);
67-
}
68-
69-
&.weight-semi-bold {
70-
font-weight: var(--font-weight-semi-bold);
71-
}
72-
73-
&.weight-bold {
74-
font-weight: var(--font-weight-bold);
75-
}
76-
77-
&.align-left {
78-
text-align: left;
79-
}
80-
81-
&.align-center {
82-
text-align: center;
83-
}
84-
85-
&.align-right {
86-
text-align: right;
2+
@each $color-name
3+
in ("white", "black", "primary", "secondary", "tertiary", "quarternary", "gradient")
4+
{
5+
@if $color-name == "gradient" {
6+
&.color-#{$color-name} {
7+
background: var(--color-text-gradient);
8+
-webkit-background-clip: text;
9+
background-clip: text;
10+
-webkit-text-fill-color: transparent;
11+
}
12+
} @else {
13+
&.color-#{$color-name} {
14+
color: var(--color-text-#{$color-name});
15+
}
16+
}
17+
}
18+
19+
@each $size-name in ("xxs", "xs", "sm", "default", "md", "lg", "xl") {
20+
&.size-#{"#{$size-name}"} {
21+
font-size: var(--font-size-#{$size-name});
22+
}
23+
}
24+
25+
@each $weight-name in ("regular", "medium", "semi-bold", "bold") {
26+
&.weight-#{"#{$weight-name}"} {
27+
font-weight: var(--font-weight-#{$weight-name});
28+
}
29+
}
30+
31+
@each $align-name in ("left", "center", "right") {
32+
&.align-#{"#{$align-name}"} {
33+
text-align: #{$align-name};
34+
}
8735
}
8836

8937
&.truncated {

0 commit comments

Comments
 (0)