Skip to content

Commit aecaa7c

Browse files
committed
refactor(styles): Migrate Chip From ReactJS
1 parent e6f35d3 commit aecaa7c

File tree

4 files changed

+53
-41
lines changed

4 files changed

+53
-41
lines changed

js/react/lib/components/chip/chip.component.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ export const Chip = (props: ChipProps) => {
1212
const { label, variant = "featured", className, ...attr } = props;
1313
return (
1414
<div
15-
className={cn(
16-
...variants[variant],
17-
"flex w-fit cursor-default items-center justify-center gap-1 transition",
18-
"[&>svg]:size-3.5",
19-
className
20-
)}
15+
className={cn(variants[variant], "rustlanges-chip", className)}
2116
{...attr}
2217
>
2318
{icons[variant] ? React.createElement(icons[variant]) : null}

js/react/lib/components/chip/chip.const.ts

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,11 @@
11
import { Location, StarBold } from "@/icons";
22

33
export const variants = {
4-
featured: [
5-
"border rounded-[20px]",
6-
"bg-primary-400 border-black text-black",
7-
"min-h-[32px]",
8-
"text-sm",
9-
"p-[4px] px-[12px]",
10-
],
11-
numeric: [
12-
"border rounded-[20px]",
13-
"bg-primary-200 border-black text-black",
14-
"min-h-[32px]",
15-
"text-sm",
16-
"p-[4px] px-[12px]",
17-
],
18-
description: [
19-
"border rounded-[20px]",
20-
"bg-secondary-200 border-black text-black",
21-
"min-h-[32px]",
22-
"text-sm",
23-
"p-[4px] px-[12px]",
24-
],
25-
location: [
26-
"border rounded-[20px]",
27-
"bg-secondary-200 border-black text-black",
28-
"min-h-[24px]",
29-
"text-sm",
30-
"p-[2px] px-[12px]",
31-
],
32-
small: [
33-
"border rounded-[20px]",
34-
"bg-secondary-200 border-black text-black",
35-
"min-h-[22px]",
36-
"text-xs",
37-
"p-[2px] px-[8px]",
38-
],
4+
featured: "rustlanges-chip--featured",
5+
numeric: "rustlanges-chip--numeric",
6+
description: "rustlanges-chip--description",
7+
location: "rustlanges-chip--location",
8+
small: "rustlanges-chip--small",
399
};
4010

4111
export type ChipVariants = keyof typeof variants;

styles/components.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import "./components/avatar.css";
22
@import "./components/badge.css";
33
@import "./components/button.css";
4+
@import "./components/chip.css";
45
@import "./components/text.css";

styles/components/chip.css

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@layer components {
2+
.rustlanges-chip {
3+
@apply flex w-fit cursor-default items-center justify-center gap-1 transition;
4+
@apply [&>svg]:size-3.5;
5+
}
6+
7+
.rustlanges-chip--featured {
8+
@apply rounded-[20px] border;
9+
@apply bg-primary-400 border-black text-black;
10+
@apply min-h-[32px];
11+
@apply text-sm;
12+
@apply p-[4px] px-[12px];
13+
}
14+
15+
.rustlanges-chip--numeric {
16+
@apply rounded-[20px] border;
17+
@apply bg-primary-200 border-black text-black;
18+
@apply min-h-[32px];
19+
@apply text-sm;
20+
@apply p-[4px] px-[12px];
21+
}
22+
23+
.rustlanges-chip--description {
24+
@apply rounded-[20px] border;
25+
@apply bg-secondary-200 border-black text-black;
26+
@apply min-h-[32px];
27+
@apply text-sm;
28+
@apply p-[4px] px-[12px];
29+
}
30+
31+
.rustlanges-chip--location {
32+
@apply rounded-[20px] border;
33+
@apply bg-secondary-200 border-black text-black;
34+
@apply min-h-[24px];
35+
@apply text-sm;
36+
@apply p-[2px] px-[12px];
37+
}
38+
39+
.rustlanges-chip--small {
40+
@apply rounded-[20px] border;
41+
@apply bg-secondary-200 border-black text-black;
42+
@apply min-h-[22px];
43+
@apply text-xs;
44+
@apply p-[2px] px-[8px];
45+
}
46+
}

0 commit comments

Comments
 (0)