Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore(storybook): fix two story-guide violations (layout decorator + variant name) (#15379)

Nikita Kabardin1ef651139e6f
diff --git a/web/src/components/ScoreTag.mdx b/web/src/components/ScoreTag.mdx
index 67a2d520eb..4c82367dd8 100644
--- a/web/src/components/ScoreTag.mdx
+++ b/web/src/components/ScoreTag.mdx
@@ -24,7 +24,7 @@ The coding is **global**: one hue per level, identical on every surface
hues are theme tokens in `globals.css` (light + dark) and live only in
`score-tag.tsx` — never restate them at a call site.
-<Canvas of={ScoreTagStories.AllLevels} />
+<Canvas of={ScoreTagStories.VariantMatrix} />
## Full vs compact
diff --git a/web/src/components/ScoreTag.stories.tsx b/web/src/components/ScoreTag.stories.tsx
index c86916bf5b..4d74406a08 100644
--- a/web/src/components/ScoreTag.stories.tsx
+++ b/web/src/components/ScoreTag.stories.tsx
@@ -24,7 +24,7 @@ const ALL_LEVELS = Object.keys(SCORE_LEVEL_LABELS) as ScoreLevel[];
// The global score-level color coding at a glance: all four levels, full pill
// and compact dot. Flip the toolbar theme to check the dark-mode tokens.
-export const AllLevels = meta.story({
+export const VariantMatrix = meta.story({
args: {
level: "trace",
},
diff --git a/web/src/features/chart-view/components/ChartViewPanel.stories.tsx b/web/src/features/chart-view/components/ChartViewPanel.stories.tsx
index 1b5822148e..d3fc62666a 100644
--- a/web/src/features/chart-view/components/ChartViewPanel.stories.tsx
+++ b/web/src/features/chart-view/components/ChartViewPanel.stories.tsx
@@ -46,17 +46,12 @@ const meta = preview.meta({
config: DEFAULT_CONFIG,
data: DATA,
onConfigChange: fn(),
+ // In production the panel fills a bounded-height flex ancestor (`flex-1`
+ // inside `EventsChartView`); standalone it needs an explicit height. Give it
+ // one through the component's own `className` prop rather than a layout
+ // decorator (Storybook guide: render the component as it is).
+ className: "h-[420px]",
},
- decorators: [
- // `ChartViewPanel`'s root relies on a bounded-height flex ancestor
- // (`flex-1`/`min-h-0`) — same as its production host (`EventsChartView`
- // inside the events table) — so give it one here.
- (Story) => (
- <div className="flex h-[420px] flex-col">
- <Story />
- </div>
- ),
- ],
});
export const Default = meta.story({});
diff --git a/web/src/features/chart-view/components/ChartViewPanel.tsx b/web/src/features/chart-view/components/ChartViewPanel.tsx
index 68e7f04418..1313beabfb 100644
--- a/web/src/features/chart-view/components/ChartViewPanel.tsx
+++ b/web/src/features/chart-view/components/ChartViewPanel.tsx
@@ -3,6 +3,7 @@ import { AlertCircle, ChevronLeft, ChevronRight, Loader2 } from "lucide-react";
import { type DashboardWidgetChartType } from "@langfuse/shared/src/db";
import { type DataPoint } from "@/src/features/widgets/chart-library/chart-props";
import { Button } from "@/src/components/ui/button";
+import { cn } from "@/src/utils/tailwind";
import {
type AggregationFn,
type ChartViewConfig,
@@ -35,6 +36,7 @@ export const ChartViewPanel = React.memo(function ChartViewPanel({
emptyMessage,
granularitySlot,
chartActions,
+ className,
}: {
config: ChartViewConfig;
onConfigChange: (patch: Partial<ChartViewConfig>) => void;
@@ -45,6 +47,10 @@ export const ChartViewPanel = React.memo(function ChartViewPanel({
granularitySlot?: React.ReactNode;
/** Right-aligned actions next to the chart subtitle (e.g. "Add to dashboard"). */
chartActions?: React.ReactNode;
+ /** Root class passthrough. The panel fills a bounded-height flex ancestor via
+ * `flex-1`; a standalone caller (e.g. a story) can give it an explicit height
+ * here instead of relying on a host. */
+ className?: string;
}) {
const [open, setOpen] = useState(true);
@@ -66,7 +72,7 @@ export const ChartViewPanel = React.memo(function ChartViewPanel({
);
return (
- <div className="flex min-h-0 flex-1 flex-col md:flex-row">
+ <div className={cn("flex min-h-0 flex-1 flex-col md:flex-row", className)}>
{/* Canvas — floored on mobile so a tall stacked config panel can't shrink
the chart to 0 on short viewports (flex-basis:0 gets none of a negative
deficit); desktop keeps min-h-0 for the side-by-side row. */}