From 36fc6b60feef3012fc894028fa19838b2b91ebf6 Mon Sep 17 00:00:00 2001 From: hitomihiumi Date: Fri, 13 Mar 2026 03:03:31 +0200 Subject: [PATCH 1/2] fix: align timeline component dimensions based on size prop for consistency --- packages/core/src/components/Timeline.tsx | 178 +++++++++++++++------- 1 file changed, 124 insertions(+), 54 deletions(-) diff --git a/packages/core/src/components/Timeline.tsx b/packages/core/src/components/Timeline.tsx index 3bd6b677..e4788ef0 100644 --- a/packages/core/src/components/Timeline.tsx +++ b/packages/core/src/components/Timeline.tsx @@ -12,34 +12,38 @@ export interface TimelineItem { children?: React.ReactNode; } -interface TimelineProps extends Omit, 'children'> { +interface TimelineProps extends Omit, "children"> { items: TimelineItem[]; alignment?: "left" | "right"; size?: TShirtSizes; } -const Timeline: React.FC = ({ - items, - alignment = "left", - size = "m", - ...flex -}) => { +const Timeline: React.FC = ({ items, alignment = "left", size = "m", ...flex }) => { // Helper to get color variable for state const getStateColor = (state: string) => { switch (state) { - case "active": return "var(--brand-solid-strong)"; - case "success": return "var(--success-solid-strong)"; - case "danger": return "var(--danger-solid-strong)"; - default: return "var(--neutral-solid-strong)"; + case "active": + return "var(--brand-solid-strong)"; + case "success": + return "var(--success-solid-strong)"; + case "danger": + return "var(--danger-solid-strong)"; + default: + return "var(--neutral-solid-strong)"; } }; + const dimensionSize = + size === "xs" ? "8" : size === "s" ? "24" : size === "m" ? "32" : size === "l" ? "40" : "48"; + const topOffset = + size === "xs" ? "20" : size === "s" ? "12" : size === "m" ? "8" : size === "l" ? "4" : "0"; + return ( {items.map((item, index) => { const state = item.state || "default"; - const nextState = index < items.length - 1 ? (items[index + 1].state || "default") : state; - + const nextState = index < items.length - 1 ? items[index + 1].state || "default" : state; + const currentColor = getStateColor(state); const nextColor = getStateColor(nextState); @@ -57,41 +61,79 @@ const Timeline: React.FC = ({ {/* Marker */} + minWidth={!isHorizontal ? dimensionSize : undefined} + maxWidth={!isHorizontal ? dimensionSize : undefined} + > {index !== 0 && ( )} - - {item.marker && ( - - {item.marker} - - )} - + + {item.marker && ( + + {item.marker} + + )} + {index !== items.length - 1 && ( = ({ {/* Content */} - <> - {item.label && ( - {item.label} - )} - {item.description && ( - - {item.description} - - )} - {item.children} - + <> + {item.label && ( + + {item.label} + + )} + {item.description && ( + + {item.description} + + )} + {item.children} + ); From 47b1997c642e4ff80be06bd11c2f444915b6deca Mon Sep 17 00:00:00 2001 From: hitomihiumi Date: Fri, 13 Mar 2026 03:06:05 +0200 Subject: [PATCH 2/2] docs: remove 'type' prop from Text component --- apps/docs/src/content/once-ui/components/text.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/docs/src/content/once-ui/components/text.mdx b/apps/docs/src/content/once-ui/components/text.mdx index b1611b7c..1a61521a 100644 --- a/apps/docs/src/content/once-ui/components/text.mdx +++ b/apps/docs/src/content/once-ui/components/text.mdx @@ -324,7 +324,6 @@ Control the rendered tag using the `as` prop. ["variant", "TextVariant"], ["size", ["xs", "s", "m", "l", "xl"]], ["weight", ["default", "strong"]], - ["type", ["display", "heading", "body", "label", "code"]], ["family", ["display", "heading", "body", "label", "code"]], ["onBackground", "`${ColorScheme}-${ColorWeight}`"], ["onSolid", "`${ColorScheme}-${ColorWeight}`"],