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

Commit 691311f

Browse files
authored
feat: add adaptive orientation to List component (#113)
1 parent 5fab338 commit 691311f

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.changeset/curly-baboons-matter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@babylonlabs-io/bbn-core-ui": patch
3+
---
4+
5+
add adaptive orientation to List component

src/components/List/List.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ import { type ListItemProps, ListItem } from "./components/ListItem";
55

66
export interface ListProps {
77
className?: string;
8-
orientation: "horizontal" | "vertical";
8+
orientation: "adaptive" | "horizontal" | "vertical";
99
children: ReactElement<ListItemProps, typeof ListItem> | ReactElement<ListItemProps, typeof ListItem>[];
1010
}
1111

1212
const STYLES = {
13+
adaptive: "px-4 md:flex md:py-3",
1314
horizontal: "flex py-3",
1415
vertical: "px-4",
1516
};
1617

1718
const ROW_ORIENTATION = {
19+
adaptive: "adaptive",
1820
horizontal: "vertical",
1921
vertical: "horizontal",
2022
} as const;

src/components/List/components/ListItem.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@ import { Text } from "@/components/Text";
44

55
export interface ListItemProps {
66
className?: string;
7-
orientation?: "horizontal" | "vertical";
7+
orientation?: "adaptive" | "horizontal" | "vertical";
88
title: string | JSX.Element;
99
value: string | JSX.Element;
1010
suffix?: JSX.Element;
1111
}
1212

1313
const STYLES = {
14+
adaptive:
15+
"flex-row items-center justify-between border-b border-secondary-strokeLight last-of-type:border-0 py-4 md:flex-1 md:flex-col md:items-start md:justify-start md:gap-1.5 md:px-6 md:py-0 md:border-b-0 md:border-r",
1416
horizontal: "flex-row items-center justify-between border-b border-secondary-strokeLight last-of-type:border-0 py-4",
15-
vertical: "flex-1 flex-col items-start justify-start gap-1.5 px-6 border-r border-secondary-strokeLight",
17+
vertical:
18+
"flex-1 flex-col items-start justify-start gap-1.5 px-6 border-r border-secondary-strokeLight last-of-type:border-0",
1619
};
1720

1821
const VALUE_STYLES = {
19-
horizontal: "flex item-center gap-1",
22+
adaptive: "flex items-center gap-1 md:justify-between md:w-full",
23+
horizontal: "flex items-center gap-1",
2024
vertical: "flex items-center justify-between w-full",
2125
};
2226

0 commit comments

Comments
 (0)