Skip to content

Commit d8af78e

Browse files
committed
fix: fix button actions on dashboard example
1 parent 4375678 commit d8af78e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

examples/dashboard/app/api/generate/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ COMPONENT DETAILS:
1515
- Metric: { label: string, valuePath: string, format?: "number"|"currency"|"percent", trend?: "up"|"down"|"neutral", trendValue?: string }
1616
- Chart: { type: "bar"|"line"|"pie"|"area", dataPath: string, title?: string, height?: number }
1717
- Table: { dataPath: string, columns: [{ key: string, label: string, format?: "text"|"currency"|"date"|"badge" }] }
18-
- Button: { label: string, action: string, variant?: "primary"|"secondary"|"danger"|"ghost" }
18+
- Button: { label: string, action: "export_report"|"refresh_data"|"view_details"|"apply_filter", variant?: "primary"|"secondary"|"danger"|"ghost" }
1919
- Heading: { text: string, level?: "h1"|"h2"|"h3"|"h4" }
2020
- Text: { content: string, variant?: "body"|"caption"|"label", color?: "default"|"muted"|"success"|"warning"|"danger" }
2121
- Badge: { text: string, variant?: "default"|"success"|"warning"|"danger"|"info" }

examples/dashboard/components/ui/button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function Button({ element, onAction, loading }: ComponentRenderProps) {
77
const { label, variant, action, disabled } = element.props as {
88
label: string;
99
variant?: string | null;
10-
action: { name: string };
10+
action: string;
1111
disabled?: boolean | null;
1212
};
1313

@@ -28,7 +28,7 @@ export function Button({ element, onAction, loading }: ComponentRenderProps) {
2828

2929
return (
3030
<button
31-
onClick={() => !disabled && action && onAction?.(action)}
31+
onClick={() => !disabled && action && onAction?.({ name: action })}
3232
disabled={!!disabled || loading}
3333
style={{
3434
padding: "8px 16px",

0 commit comments

Comments
 (0)