Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit aa8395b

Browse files
authored
feat: separate legacy list to new list (#133)
* Separate legacy list to new list * Export ListLegacy * Revert color
1 parent 5aee6b0 commit aa8395b

File tree

10 files changed

+223
-149
lines changed

10 files changed

+223
-149
lines changed

src/components/List/List.css

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
11
.bbn-list {
2-
@apply rounded border border-secondary-strokeLight;
3-
4-
&-horizontal {
5-
@apply flex py-3;
6-
}
7-
8-
&-vertical {
9-
@apply px-4;
10-
}
11-
12-
&-adaptive {
13-
@apply px-4 md:flex md:py-3;
14-
}
15-
}
16-
17-
.bbn-list-new-design {
182
@apply flex items-start gap-2;
193

204
&-horizontal {
@@ -31,46 +15,23 @@
3115
}
3216

3317
.bbn-list-item {
34-
@apply flex;
35-
36-
&-horizontal {
37-
@apply flex-row items-center justify-between border-b border-secondary-strokeLight py-4 last-of-type:border-0;
38-
}
39-
40-
&-vertical {
41-
@apply flex-1 flex-col items-start justify-start gap-1.5 border-r border-secondary-strokeLight px-6 last-of-type:border-0;
42-
}
43-
44-
&-adaptive {
45-
@apply flex-row items-center justify-between border-b border-secondary-strokeLight py-4 last-of-type:border-0 md:flex-1 md:flex-col md:items-start md:justify-start md:gap-1.5 md:border-b-0 md:border-r md:px-6 md:py-0;
46-
}
47-
}
48-
49-
.bbn-list-item-new-design {
5018
@apply flex border-0 rounded bg-secondary-highlight px-6 py-4 w-full;
5119

5220
&-horizontal {
53-
@apply flex-row items-center justify-between border-b border-secondary-strokeLight py-4 last-of-type:border-0;
21+
@apply flex-row items-center justify-between py-4 border-0;
5422
}
5523

5624
&-vertical {
57-
@apply flex-1 flex-col items-start justify-start gap-1.5 border-r border-secondary-strokeLight px-6 last-of-type:border-0;
25+
@apply flex-1 flex-col items-start justify-start gap-1.5 px-6 border-0;
5826
}
5927

6028
&-adaptive {
61-
@apply flex-1 items-center justify-between py-4 md:flex-col md:items-start md:justify-center md:px-6 md:py-0 md:flex-1 md:h-auto;
29+
@apply flex-1 border-0 items-center justify-between py-4 md:flex-col md:items-start md:justify-center md:px-6 md:py-0 md:flex-1 md:h-auto;
6230
}
6331
}
6432

65-
.bbn-list-title {
66-
@apply text-accent-secondary;
67-
68-
&-adaptive {
69-
@apply text-base md:text-sm;
70-
}
71-
}
7233

73-
.bbn-list-title-new-design {
34+
.bbn-list-title {
7435
@apply text-accent-primary;
7536

7637
&-adaptive {
@@ -79,22 +40,6 @@
7940
}
8041

8142
.bbn-list-value {
82-
@apply text-accent-secondary;
83-
84-
&-horizontal {
85-
@apply flex items-center gap-1;
86-
}
87-
88-
&-vertical {
89-
@apply flex w-full items-center justify-between;
90-
}
91-
92-
&-adaptive {
93-
@apply flex items-center gap-1 md:w-full md:justify-between;
94-
}
95-
}
96-
97-
.bbn-list-value-new-design {
9843
@apply text-accent-primary;
9944

10045
&-horizontal {

src/components/List/List.stories.tsx

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ const meta: Meta<typeof List> = {
1212
control: { type: "select" },
1313
options: ["horizontal", "vertical", "adaptive"],
1414
},
15-
newDesign: {
16-
control: { type: "boolean" },
17-
},
1815
},
1916
};
2017

@@ -43,7 +40,6 @@ export const HorizontalRegular: Story = {
4340
name: "Regular Design - Horizontal",
4441
args: {
4542
orientation: "horizontal",
46-
newDesign: false,
4743
children: sampleItems,
4844
},
4945
};
@@ -52,7 +48,6 @@ export const VerticalRegular: Story = {
5248
name: "Regular Design - Vertical",
5349
args: {
5450
orientation: "vertical",
55-
newDesign: false,
5651
children: sampleItems,
5752
},
5853
};
@@ -61,35 +56,6 @@ export const AdaptiveRegular: Story = {
6156
name: "Regular Design - Adaptive",
6257
args: {
6358
orientation: "adaptive",
64-
newDesign: false,
65-
children: sampleItems,
66-
},
67-
};
68-
69-
// New Design Stories
70-
export const HorizontalNewDesign: Story = {
71-
name: "New Design - Horizontal",
72-
args: {
73-
orientation: "horizontal",
74-
newDesign: true,
75-
children: sampleItems,
76-
},
77-
};
78-
79-
export const VerticalNewDesign: Story = {
80-
name: "New Design - Vertical",
81-
args: {
82-
orientation: "vertical",
83-
newDesign: true,
84-
children: sampleItems,
85-
},
86-
};
87-
88-
export const AdaptiveNewDesign: Story = {
89-
name: "New Design - Adaptive",
90-
args: {
91-
orientation: "adaptive",
92-
newDesign: true,
9359
children: sampleItems,
9460
},
9561
};
@@ -99,7 +65,6 @@ export const LongContentHorizontal: Story = {
9965
name: "Long Content - Horizontal",
10066
args: {
10167
orientation: "horizontal",
102-
newDesign: false,
10368
children: longContentItems,
10469
},
10570
};
@@ -108,7 +73,6 @@ export const LongContentVertical: Story = {
10873
name: "Long Content - Vertical",
10974
args: {
11075
orientation: "vertical",
111-
newDesign: false,
11276
children: longContentItems,
11377
},
11478
};
@@ -117,29 +81,6 @@ export const SingleItem: Story = {
11781
name: "Single Item",
11882
args: {
11983
orientation: "horizontal",
120-
newDesign: false,
12184
children: [<ListItem title="Single Entry" value="Only one item in list" suffix={<MdOutlineInfo size={20} />} />],
12285
},
12386
};
124-
125-
// Interactive/Playground Story
126-
export const Playground: Story = {
127-
name: "Playground",
128-
args: {
129-
orientation: "horizontal",
130-
newDesign: false,
131-
children: sampleItems,
132-
},
133-
};
134-
135-
// Legacy - keeping the original Default story
136-
export const Default: Story = {
137-
args: {
138-
orientation: "horizontal",
139-
children: [
140-
<ListItem title="Signet Bitcoin Balance" value="100.123456 sBTC" />,
141-
<ListItem title="Signet Bitcoin Balance" value="100.123456 sBTC" />,
142-
<ListItem title="Signet Bitcoin Balance" value="100.123456 sBTC" suffix={<MdOutlineInfo size={24} />} />,
143-
],
144-
},
145-
};

src/components/List/List.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { type ListItemProps, ListItem } from "./components/ListItem";
66

77
export interface ListProps {
88
className?: string;
9-
newDesign?: boolean;
109
orientation: "adaptive" | "horizontal" | "vertical";
1110
children: ReactElement<ListItemProps, typeof ListItem> | ReactElement<ListItemProps, typeof ListItem>[];
1211
}
@@ -17,26 +16,13 @@ const ROW_ORIENTATION = {
1716
vertical: "horizontal",
1817
} as const;
1918

20-
export function List({
21-
newDesign = false,
22-
className,
23-
orientation = "vertical",
24-
children,
25-
}: PropsWithChildren<ListProps>) {
26-
const getListClasses = () => {
27-
if (newDesign) {
28-
return twMerge("bbn-list-new-design", `bbn-list-new-design-${orientation}`, className);
29-
}
30-
return twMerge("bbn-list", `bbn-list-${orientation}`, className);
31-
};
32-
19+
export function List({ className, orientation = "vertical", children }: PropsWithChildren<ListProps>) {
3320
return (
34-
<div className={getListClasses()}>
21+
<div className={twMerge("bbn-list", `bbn-list-${orientation}`, className)}>
3522
{Children.map(children, (item) =>
3623
isValidElement(item)
3724
? cloneElement(item, {
3825
orientation: ROW_ORIENTATION[orientation],
39-
newDesign,
4026
})
4127
: item,
4228
)}

src/components/List/components/ListItem.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,25 @@ import { twJoin } from "tailwind-merge";
33
import { Text } from "@/components/Text";
44

55
export interface ListItemProps {
6-
newDesign?: boolean;
76
className?: string;
87
orientation?: "adaptive" | "horizontal" | "vertical";
98
title: string | JSX.Element;
109
value: string | JSX.Element;
1110
suffix?: JSX.Element;
1211
}
1312

14-
export function ListItem({ newDesign, className, orientation = "horizontal", title, value, suffix }: ListItemProps) {
13+
export function ListItem({ className, orientation = "horizontal", title, value, suffix }: ListItemProps) {
1514
return (
16-
<div
17-
className={twJoin(
18-
newDesign ? "bbn-list-item-new-design" : "bbn-list-item",
19-
`bbn-list-item-${orientation}`,
20-
className,
21-
)}
22-
>
15+
<div className={twJoin("bbn-list-item", `bbn-list-item-${orientation}`, className)}>
2316
<Text
2417
as="div"
25-
className={twJoin(newDesign ? "bbn-list-title-new-design" : "bbn-list-title", `bbn-list-title-${orientation}`)}
18+
className={twJoin("bbn-list-title", `bbn-list-title-${orientation}`)}
2619
variant={orientation === "horizontal" ? "body1" : "body2"}
2720
>
2821
{title}
2922
</Text>
3023

31-
<Text
32-
as="div"
33-
className={twJoin(newDesign ? "bbn-list-value-new-design" : "bbn-list-value", `bbn-list-value-${orientation}`)}
34-
variant="body1"
35-
>
24+
<Text as="div" className={twJoin("bbn-list-value", `bbn-list-value-${orientation}`)} variant="body1">
3625
{value}
3726
{suffix}
3827
</Text>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
.bbn-list-legacy {
2+
@apply rounded border border-secondary-strokeLight;
3+
4+
&-horizontal {
5+
@apply flex py-3;
6+
}
7+
8+
&-vertical {
9+
@apply px-4;
10+
}
11+
12+
&-adaptive {
13+
@apply px-4 md:flex md:py-3;
14+
}
15+
}
16+
17+
.bbn-list-item-legacy {
18+
@apply flex;
19+
20+
&-horizontal {
21+
@apply flex-row items-center justify-between border-b border-secondary-strokeLight py-4 last-of-type:border-0;
22+
}
23+
24+
&-vertical {
25+
@apply flex-1 flex-col items-start justify-start gap-1.5 border-r border-secondary-strokeLight px-6 last-of-type:border-0;
26+
}
27+
28+
&-adaptive {
29+
@apply flex-row items-center justify-between border-b border-secondary-strokeLight py-4 last-of-type:border-0 md:flex-1 md:flex-col md:items-start md:justify-start md:gap-1.5 md:border-b-0 md:border-r md:px-6 md:py-0;
30+
}
31+
}
32+
33+
.bbn-list-title-legacy {
34+
@apply text-accent-secondary;
35+
36+
&-adaptive {
37+
@apply text-base md:text-sm;
38+
}
39+
}
40+
41+
.bbn-list-value-legacy {
42+
@apply text-accent-primary;
43+
44+
&-horizontal {
45+
@apply flex items-center gap-1;
46+
}
47+
48+
&-vertical {
49+
@apply flex w-full items-center justify-between;
50+
}
51+
52+
&-adaptive {
53+
@apply flex items-center gap-1 md:w-full md:justify-between;
54+
}
55+
}

0 commit comments

Comments
 (0)