Raw
1 import { Text, clx } from "@medusajs/ui";
2
3 export type SectionRowProps = {
4 title: string;
5 value?: React.ReactNode | string | null;
6 actions?: React.ReactNode;
7 };
8
9 export const SectionRow = ({ title, value, actions }: SectionRowProps) => {
10 const isValueString = typeof value === "string" || !value;
11
12 return (
13 <div
14 className={clx(
15 `text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4`,
16 {
17 "grid-cols-[1fr_1fr_28px]": !!actions,
18 }
19 )}
20 >
21 <Text size="small" weight="plus" leading="compact">
22 {title}
23 </Text>
24
25 {isValueString ? (
26 <Text
27 size="small"
28 leading="compact"
29 className="whitespace-pre-line text-pretty"
30 >
31 {value ?? "-"}
32 </Text>
33 ) : (
34 <div className="flex flex-wrap gap-1">{value}</div>
35 )}
36
37 {actions && <div>{actions}</div>}
38 </div>
39 );
40 };