From 91ceef7e72b6911bac8d470378d51746e6ebd35f Mon Sep 17 00:00:00 2001 From: Hristo Nedelkov Date: Tue, 15 Aug 2023 13:21:37 +0300 Subject: [PATCH] Add story for consensus --- .../SyncStatusCardConsensus.stories.tsx | 37 +++++++++++++++++++ src/components/SyncStatusCardConsensus.tsx | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/components/SyncStatusCardConsensus.stories.tsx diff --git a/src/components/SyncStatusCardConsensus.stories.tsx b/src/components/SyncStatusCardConsensus.stories.tsx new file mode 100644 index 00000000..8c3a634c --- /dev/null +++ b/src/components/SyncStatusCardConsensus.stories.tsx @@ -0,0 +1,37 @@ +import type { Meta, StoryObj } from '@storybook/react' + +import SyncStatusCardConsensus from './SyncStatusCardConsensus' + +const meta = { + title: 'General/SyncStatusCardConsensus', + component: SyncStatusCardConsensus, + parameters: { + layout: 'centered', + }, + tags: ['autodocs'], + decorators: [ + Story => ( +
+ +
+ ), + ], +} satisfies Meta + +export default meta +type Story = StoryObj + +export const WithData: Story = { + args: { + synced: 132432, + total: 200000, + }, +} +export const WithoutData: Story = { + args: { + synced: 0, + total: 0, + }, +} + + diff --git a/src/components/SyncStatusCardConsensus.tsx b/src/components/SyncStatusCardConsensus.tsx index 3cb55807..2aa80e8a 100644 --- a/src/components/SyncStatusCardConsensus.tsx +++ b/src/components/SyncStatusCardConsensus.tsx @@ -21,7 +21,7 @@ const SyncStatusCardConsensus: React.FC = ({ synced, t { id: 'storage', label: 'Free', - value: total - synced, + value: total - synced || 1, color: '#E7EAEE', }, ]