diff --git a/src/figma/compositions/DashboardBarChart.figma.tsx b/src/figma/compositions/DashboardBarChart.figma.tsx index bc5d852d..4d37135a 100644 --- a/src/figma/compositions/DashboardBarChart.figma.tsx +++ b/src/figma/compositions/DashboardBarChart.figma.tsx @@ -1,5 +1,6 @@ import figma from "@figma/code-connect"; import { + DashboardBarChart, GraphHeader, GraphVisualisation, } from "compositions"; @@ -33,3 +34,22 @@ figma.connect( ), }, ); + +figma.connect( + DashboardBarChart, + "https://www.figma.com/design/RunXbtjgAaAIsNgvyEndOD/MCP-Design-System?node-id=6-513&m=dev", + { + example: () => ( + + ), + }, +); diff --git a/src/stories/compositions/DashboardBarChart.stories.tsx b/src/stories/compositions/DashboardBarChart.stories.tsx index 2fc86a09..af43ed9c 100644 --- a/src/stories/compositions/DashboardBarChart.stories.tsx +++ b/src/stories/compositions/DashboardBarChart.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from "@storybook/react"; -import { GraphHeader } from "compositions"; +import { DashboardBarChart, GraphHeader } from "compositions"; const meta: Meta = { component: GraphHeader, @@ -58,3 +58,24 @@ export const StoryGraphHeaderWithoutAI: StoryObj = { ), }; + +export const Default: StoryObj = { + args: { + title: "Gross Pay Ins", + aiButtons: [{ label: "Analyse" }], + keys: [ + { label: "Key Label" }, + { label: "Key Label" }, + { label: "Key Label" }, + ], + dates: [{ label: "01 Aug" }, { label: "07 Aug" }], + }, + argTypes: { + title: { control: { type: "text" } }, + }, + render: (args) => ( +
+ +
+ ), +}; diff --git a/src/ui/compositions/DashboardBarChart/DashboardBarChart.tsx b/src/ui/compositions/DashboardBarChart/DashboardBarChart.tsx new file mode 100644 index 00000000..2f5edbd3 --- /dev/null +++ b/src/ui/compositions/DashboardBarChart/DashboardBarChart.tsx @@ -0,0 +1,48 @@ +import { clsx } from "clsx"; +import type { ReactNode } from "react"; +import { GraphHeader } from "./GraphHeader"; +import { GraphVisualisation } from "./GraphVisualisation"; +import "./dashboard-bar-chart.css"; + +export type DashboardBarChartProps = { + /** The title text displayed in the header */ + title: ReactNode; + /** Array of AI button configurations */ + aiButtons?: Array<{ + label: string; + onPress?: () => void; + }>; + /** The key/legend items displayed above the chart */ + keys?: Array<{ + label: string; + color?: string; + }>; + /** The date labels displayed below the chart */ + dates?: Array<{ + label: string; + }>; + /** Optional custom chart content */ + chart?: ReactNode; + /** Additional CSS class names */ + className?: string; +}; + +/** + * A complete dashboard bar chart card that combines a graph header + * with a graph visualisation inside a styled container. + */ +export function DashboardBarChart({ + title, + aiButtons, + keys, + dates, + chart, + className, +}: DashboardBarChartProps) { + return ( +
+ + +
+ ); +} diff --git a/src/ui/compositions/DashboardBarChart/dashboard-bar-chart.css b/src/ui/compositions/DashboardBarChart/dashboard-bar-chart.css new file mode 100644 index 00000000..b614ccf0 --- /dev/null +++ b/src/ui/compositions/DashboardBarChart/dashboard-bar-chart.css @@ -0,0 +1,10 @@ +.dashboard-bar-chart { + background: var(--mcp-color-surface-primary-light); + display: flex; + flex-direction: column; + align-items: flex-start; + overflow: clip; + border-radius: var(--sds-size-radius-400); + box-shadow: var(--sds-effects-shadows-drop-shadow-600); + width: 100%; +} diff --git a/src/ui/compositions/index.ts b/src/ui/compositions/index.ts index b2893f9b..4fb8cd89 100644 --- a/src/ui/compositions/index.ts +++ b/src/ui/compositions/index.ts @@ -1,2 +1,3 @@ +export * from "./DashboardBarChart/DashboardBarChart"; export * from "./DashboardBarChart/GraphHeader"; export * from "./DashboardBarChart/GraphVisualisation";