Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/figma/compositions/DashboardBarChart.figma.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import figma from "@figma/code-connect";
import {
DashboardBarChart,
GraphHeader,
GraphVisualisation,
} from "compositions";
Expand Down Expand Up @@ -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: () => (
<DashboardBarChart
header={{
title: "Title text",
aiButtonLabel: "Analyse",
}}
visualisation={{
keys: [{ label: "Label" }, { label: "Label" }, { label: "Label" }],
dates: [{ label: "01 Aug" }, { label: "07 Aug" }],
}}
/>
),
},
);
28 changes: 27 additions & 1 deletion src/stories/compositions/DashboardBarChart.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { GraphHeader } from "compositions";
import { DashboardBarChart, GraphHeader } from "compositions";

const meta: Meta<typeof GraphHeader> = {
component: GraphHeader,
Expand Down Expand Up @@ -58,3 +58,29 @@ export const StoryGraphHeaderWithoutAI: StoryObj<typeof GraphHeader> = {
</div>
),
};

export const StoryDashboardBarChart: StoryObj<typeof DashboardBarChart> = {
name: "Complete Dashboard Bar Chart",
args: {
header: {
title: "Gross Pay Ins",
aiButtonLabel: "Analyse",
},
visualisation: {
keys: [
{ label: "Key Label" },
{ label: "Key Label" },
{ label: "Key Label" },
],
dates: [
{ label: "01 Aug" },
{ label: "07 Aug" },
],
},
},
render: (args) => (
<div style={{ width: 560 }}>
<DashboardBarChart {...args} />
</div>
),
};
31 changes: 31 additions & 0 deletions src/ui/compositions/DashboardBarChart/DashboardBarChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { clsx } from "clsx";
import { GraphHeader, type GraphHeaderProps } from "./GraphHeader";
import { GraphVisualisation, type GraphVisualisationProps } from "./GraphVisualisation";
import "./dashboard-bar-chart.css";

export type DashboardBarChartProps = {
/** Props for the GraphHeader component */
header?: GraphHeaderProps;
/** Props for the GraphVisualisation component */
visualisation?: GraphVisualisationProps;
/** Additional CSS class names */
className?: string;
};

/**
* A dashboard bar chart card that combines a header with title and AI buttons,
* and a graph visualisation with keys and dates. Displays as a white card with
* rounded corners and shadow.
*/
export function DashboardBarChart({
header,
visualisation,
className,
}: DashboardBarChartProps) {
return (
<div className={clsx("dashboard-bar-chart", className)}>
{header && <GraphHeader {...header} />}
{visualisation && <GraphVisualisation {...visualisation} />}
</div>
);
}
10 changes: 10 additions & 0 deletions src/ui/compositions/DashboardBarChart/dashboard-bar-chart.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.dashboard-bar-chart {
display: flex;
flex-direction: column;
align-items: flex-start;
width: 100%;
background: var(--mcp-color-surface-primary-light);
border-radius: var(--sds-size-radius-400);
box-shadow: var(--sds-effects-shadows-drop-shadow-600);
overflow: hidden;
}
1 change: 1 addition & 0 deletions src/ui/compositions/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./DashboardBarChart/DashboardBarChart";
export * from "./DashboardBarChart/GraphHeader";
export * from "./DashboardBarChart/GraphVisualisation";