From 1f3942b0e67bae87fddc7506bf2abdb025befcd7 Mon Sep 17 00:00:00 2001 From: Joe <49767913+joebudi@users.noreply.github.com> Date: Sat, 28 Nov 2020 16:35:42 +0000 Subject: [PATCH] Stat card During lab day, I created a stat card. This card allows the user to display a single value, with an optional title and label. This is a popular component that will save our users time - expecially when creating dashboards. --- .../userInterface/temporaryPanelStructure.js | 43 +++++++++++++++ packages/standard-components/components.json | 10 ++++ .../standard-components/src/CardStat.svelte | 52 +++++++++++++++++++ packages/standard-components/src/index.js | 1 + 4 files changed, 106 insertions(+) create mode 100644 packages/standard-components/src/CardStat.svelte diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index e18ca6014f..092f4eafdd 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -427,6 +427,49 @@ export default { ], }, }, + { + _component: "@budibase/standard-components/cardstat", + name: "Stat", + description: + "A card component for displaying numbers.", + icon: "ri-dual-sim-2-line", + children: [], + properties: { + design: { ...all }, + settings: [ + { + label: "Title", + key: "title", + control: Input, + placeholder: "Total Revenue", + }, + { + label: "Value", + key: "value", + control: Input, + placeholder: "$1,981,983", + }, + { + label: "Label", + key: "label", + control: Input, + placeholder: "Stripe", + }, + { + label: "Value Color", + key: "color", + control: Input, + placeholder: "Blue", + }, + { + label: "Border Color", + key: "bordercolor", + control: Input, + placeholder: "lightgrey", + }, + ], + }, + }, ], }, { diff --git a/packages/standard-components/components.json b/packages/standard-components/components.json index a766d3084c..0843a17ffe 100644 --- a/packages/standard-components/components.json +++ b/packages/standard-components/components.json @@ -359,6 +359,16 @@ } } }, + "cardstat": { + "name": "Stat Card", + "props": { + "title": "string", + "value": "string", + "label": "string", + "color": "string", + "bordercolor": "string" + } + }, "cardhorizontal": { "name": "Horizontal Card", "props": { diff --git a/packages/standard-components/src/CardStat.svelte b/packages/standard-components/src/CardStat.svelte new file mode 100644 index 0000000000..cb58bdfb5a --- /dev/null +++ b/packages/standard-components/src/CardStat.svelte @@ -0,0 +1,52 @@ + + +
+

{title}

+

{value}

+

{label}

+
+ + diff --git a/packages/standard-components/src/index.js b/packages/standard-components/src/index.js index 3dec13e27b..89189a287b 100644 --- a/packages/standard-components/src/index.js +++ b/packages/standard-components/src/index.js @@ -23,6 +23,7 @@ export { default as embed } from "./Embed.svelte" export { default as stackedlist } from "./StackedList.svelte" export { default as card } from "./Card.svelte" export { default as cardhorizontal } from "./CardHorizontal.svelte" +export { default as cardstat } from "./CardStat.svelte" export { default as rowdetail } from "./RowDetail.svelte" export { default as newrow } from "./NewRow.svelte" export { default as datepicker } from "./DatePicker.svelte"