From fd767e1d451bc1ec2a2adfae365d41bc984587f8 Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Fri, 15 Sep 2023 20:48:36 +0300 Subject: [PATCH] feat: export years to reuse --- src/constants.ts | 17 ++++++++++ .../BalanceLineChart/BalanceChardCard.tsx | 2 +- .../BalanceLineChart/LineChart.stories.tsx | 34 ++++++++++--------- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index caf61c22..414a0549 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -15,3 +15,20 @@ export const BAD_NETWORK_TEXT = 'Network Latency is high.' export const KEYSTORE_FILES = 'KeystoreFiles' export const RECOVERY_PHRASE = 'Recovery Phrase' export const BOTH_KEY_AND_RECOVERY = 'Both KeystoreFiles & Recovery Phrase' + +/* Dashboard */ + +export const years = [ + 'JAN', + 'FEB', + 'MAR', + 'APR', + 'MAY', + 'JUN', + 'JUL', + 'AUG', + 'SEPT', + 'OCT', + 'NOV', + 'DEC', +] diff --git a/src/pages/Dashboard/BalanceLineChart/BalanceChardCard.tsx b/src/pages/Dashboard/BalanceLineChart/BalanceChardCard.tsx index 00319629..26558638 100644 --- a/src/pages/Dashboard/BalanceLineChart/BalanceChardCard.tsx +++ b/src/pages/Dashboard/BalanceLineChart/BalanceChardCard.tsx @@ -7,9 +7,9 @@ import { DateRange } from 'react-day-picker' import DashboardCardWrapper from '../DashboardCardWrapper' import LineChart from './LineChart' import Icon from '../../../components/General/Icon' +import { years } from '../../../constants' import './calendar.css' -const years = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEPT', 'OCT', 'NOV', 'DEC'] const userGains = [ 10000, 15000, 17500, 20000, 19000, 23222, 25000, 20000, 20000, 21000, 22300, 21000, ] diff --git a/src/pages/Dashboard/BalanceLineChart/LineChart.stories.tsx b/src/pages/Dashboard/BalanceLineChart/LineChart.stories.tsx index 6652c699..b5061ec6 100644 --- a/src/pages/Dashboard/BalanceLineChart/LineChart.stories.tsx +++ b/src/pages/Dashboard/BalanceLineChart/LineChart.stories.tsx @@ -1,29 +1,31 @@ import type { Meta, StoryObj } from '@storybook/react' import LineChart from './LineChart' import { Stack } from 'tamagui' +import { years } from '../../../constants' -const years = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEPT', 'OCT', 'NOV', 'DEC'] -const userGains = [10000, 15000, 17500, 20000, 19000, 23222, 25000, 20000, 20000, 21000, 22300, 21000] +const userGains = [ + 10000, 15000, 17500, 20000, 19000, 23222, 25000, 20000, 20000, 21000, 22300, 21000, +] const meta = { - title: 'Dashboard/LineChart', - component: LineChart, - parameters: { - layout: 'centered', - }, - tags: ['autodocs'], - decorators: [StoryObj => - ( - - , - - ) - ] + title: 'Dashboard/LineChart', + component: LineChart, + parameters: { + layout: 'centered', + }, + tags: ['autodocs'], + decorators: [ + StoryObj => ( + + , + + ), + ], } satisfies Meta export default meta type Story = StoryObj export const Page: Story = { - args: { userGains, years }, + args: { userGains, years }, }