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

Commit 5aee6b0

Browse files
authored
feat: phase 3 design changes (#132)
* Phase 3 design changes * Make design backwards compatible * Refactor * Fix full width listitem
1 parent 636c00a commit 5aee6b0

File tree

5 files changed

+216
-11
lines changed

5 files changed

+216
-11
lines changed

src/components/Card/Card.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.bbn-card {
22
@apply bg-surface border-secondary-strokeLight rounded border p-6;
3-
}
3+
}

src/components/List/List.css

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@
1414
}
1515
}
1616

17+
.bbn-list-new-design {
18+
@apply flex items-start gap-2;
19+
20+
&-horizontal {
21+
@apply flex-row;
22+
}
23+
24+
&-vertical {
25+
@apply flex-col;
26+
}
27+
28+
&-adaptive {
29+
@apply flex-col md:flex-row;
30+
}
31+
}
32+
1733
.bbn-list-item {
1834
@apply flex;
1935

@@ -30,6 +46,22 @@
3046
}
3147
}
3248

49+
.bbn-list-item-new-design {
50+
@apply flex border-0 rounded bg-secondary-highlight px-6 py-4 w-full;
51+
52+
&-horizontal {
53+
@apply flex-row items-center justify-between border-b border-secondary-strokeLight py-4 last-of-type:border-0;
54+
}
55+
56+
&-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;
58+
}
59+
60+
&-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;
62+
}
63+
}
64+
3365
.bbn-list-title {
3466
@apply text-accent-secondary;
3567

@@ -38,9 +70,17 @@
3870
}
3971
}
4072

41-
.bbn-list-value {
73+
.bbn-list-title-new-design {
4274
@apply text-accent-primary;
4375

76+
&-adaptive {
77+
@apply text-base md:text-sm;
78+
}
79+
}
80+
81+
.bbn-list-value {
82+
@apply text-accent-secondary;
83+
4484
&-horizontal {
4585
@apply flex items-center gap-1;
4686
}
@@ -53,3 +93,19 @@
5393
@apply flex items-center gap-1 md:w-full md:justify-between;
5494
}
5595
}
96+
97+
.bbn-list-value-new-design {
98+
@apply text-accent-primary;
99+
100+
&-horizontal {
101+
@apply flex items-center gap-1;
102+
}
103+
104+
&-vertical {
105+
@apply flex w-full items-center justify-between;
106+
}
107+
108+
&-adaptive {
109+
@apply flex items-center gap-1 md:w-full md:justify-between;
110+
}
111+
}

src/components/List/List.stories.tsx

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,138 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import { MdOutlineInfo } from "react-icons/md";
2+
import { MdOutlineInfo, MdAccountBalanceWallet, MdTrendingUp } from "react-icons/md";
33

44
import { List } from "./List";
55
import { ListItem } from "./components/ListItem";
66

77
const meta: Meta<typeof List> = {
88
component: List,
99
tags: ["autodocs"],
10+
argTypes: {
11+
orientation: {
12+
control: { type: "select" },
13+
options: ["horizontal", "vertical", "adaptive"],
14+
},
15+
newDesign: {
16+
control: { type: "boolean" },
17+
},
18+
},
1019
};
1120

1221
export default meta;
1322

1423
type Story = StoryObj<typeof meta>;
1524

25+
const sampleItems = [
26+
<ListItem title="Bitcoin Balance" value="100.123456 BTC" suffix={<MdAccountBalanceWallet size={20} />} />,
27+
<ListItem title="USD Value" value="$4,567,890.12" suffix={<MdTrendingUp size={20} />} />,
28+
<ListItem title="Status" value="Active" suffix={<MdOutlineInfo size={20} />} />,
29+
];
30+
31+
const longContentItems = [
32+
<ListItem title="Very Long Bitcoin Wallet Address" value="bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh" />,
33+
<ListItem title="Transaction Hash with Very Long Text" value="a1b2c3d4e5f6789012345678901234567890abcdef" />,
34+
<ListItem
35+
title="Network Fee Estimation Details"
36+
value="2.5 sats/vB (Medium Priority)"
37+
suffix={<MdOutlineInfo size={20} />}
38+
/>,
39+
];
40+
41+
// Regular Design Stories
42+
export const HorizontalRegular: Story = {
43+
name: "Regular Design - Horizontal",
44+
args: {
45+
orientation: "horizontal",
46+
newDesign: false,
47+
children: sampleItems,
48+
},
49+
};
50+
51+
export const VerticalRegular: Story = {
52+
name: "Regular Design - Vertical",
53+
args: {
54+
orientation: "vertical",
55+
newDesign: false,
56+
children: sampleItems,
57+
},
58+
};
59+
60+
export const AdaptiveRegular: Story = {
61+
name: "Regular Design - Adaptive",
62+
args: {
63+
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,
93+
children: sampleItems,
94+
},
95+
};
96+
97+
// Content Variation Stories
98+
export const LongContentHorizontal: Story = {
99+
name: "Long Content - Horizontal",
100+
args: {
101+
orientation: "horizontal",
102+
newDesign: false,
103+
children: longContentItems,
104+
},
105+
};
106+
107+
export const LongContentVertical: Story = {
108+
name: "Long Content - Vertical",
109+
args: {
110+
orientation: "vertical",
111+
newDesign: false,
112+
children: longContentItems,
113+
},
114+
};
115+
116+
export const SingleItem: Story = {
117+
name: "Single Item",
118+
args: {
119+
orientation: "horizontal",
120+
newDesign: false,
121+
children: [<ListItem title="Single Entry" value="Only one item in list" suffix={<MdOutlineInfo size={20} />} />],
122+
},
123+
};
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
16136
export const Default: Story = {
17137
args: {
18138
orientation: "horizontal",

src/components/List/List.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { type PropsWithChildren, Children, cloneElement, isValidElement, ReactElement } from "react";
2-
import { twMerge } from "tailwind-merge";
32
import "./List.css";
3+
import { twMerge } from "tailwind-merge";
44

55
import { type ListItemProps, ListItem } from "./components/ListItem";
66

77
export interface ListProps {
88
className?: string;
9+
newDesign?: boolean;
910
orientation: "adaptive" | "horizontal" | "vertical";
1011
children: ReactElement<ListItemProps, typeof ListItem> | ReactElement<ListItemProps, typeof ListItem>[];
1112
}
@@ -16,11 +17,28 @@ const ROW_ORIENTATION = {
1617
vertical: "horizontal",
1718
} as const;
1819

19-
export function List({ className, orientation = "vertical", children }: PropsWithChildren<ListProps>) {
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+
2033
return (
21-
<div className={twMerge("bbn-list", `bbn-list-${orientation}`, className)}>
34+
<div className={getListClasses()}>
2235
{Children.map(children, (item) =>
23-
isValidElement(item) ? cloneElement(item, { orientation: ROW_ORIENTATION[orientation] }) : item,
36+
isValidElement(item)
37+
? cloneElement(item, {
38+
orientation: ROW_ORIENTATION[orientation],
39+
newDesign,
40+
})
41+
: item,
2442
)}
2543
</div>
2644
);

src/components/List/components/ListItem.tsx

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

55
export interface ListItemProps {
6+
newDesign?: boolean;
67
className?: string;
78
orientation?: "adaptive" | "horizontal" | "vertical";
89
title: string | JSX.Element;
910
value: string | JSX.Element;
1011
suffix?: JSX.Element;
1112
}
1213

13-
export function ListItem({ className, orientation = "horizontal", title, value, suffix }: ListItemProps) {
14+
export function ListItem({ newDesign, className, orientation = "horizontal", title, value, suffix }: ListItemProps) {
1415
return (
15-
<div className={twJoin("bbn-list-item", `bbn-list-item-${orientation}`, className)}>
16+
<div
17+
className={twJoin(
18+
newDesign ? "bbn-list-item-new-design" : "bbn-list-item",
19+
`bbn-list-item-${orientation}`,
20+
className,
21+
)}
22+
>
1623
<Text
1724
as="div"
18-
className={twJoin("bbn-list-title", `bbn-list-title-${orientation}`)}
25+
className={twJoin(newDesign ? "bbn-list-title-new-design" : "bbn-list-title", `bbn-list-title-${orientation}`)}
1926
variant={orientation === "horizontal" ? "body1" : "body2"}
2027
>
2128
{title}
2229
</Text>
2330

24-
<Text as="div" className={twJoin("bbn-list-value", `bbn-list-value-${orientation}`)} variant="body1">
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+
>
2536
{value}
2637
{suffix}
2738
</Text>

0 commit comments

Comments
 (0)