From 7a7e493f6e61a0a00ab3ac78a06cfa0260a3429f Mon Sep 17 00:00:00 2001 From: ClaudiaHolhos Date: Wed, 22 Jun 2022 16:41:16 +0300 Subject: [PATCH] fixes --- src/@context/MarketMetadata/index.tsx | 6 ++-- .../AssetComputeList/index.stories.tsx | 15 ++++++---- .../AssetListTitle/index.stories.tsx | 10 +++++-- .../AssetSelection/index.stories.tsx | 13 ++++++-- src/components/@shared/Page/index.stories.tsx | 13 ++++++++ .../@shared/Pagination/index.stories.tsx | 30 +++++++++++++++++++ .../@shared/Price/PriceUnit/index.stories.tsx | 3 +- .../{Add.module.css => Add/index.module.css} | 0 .../@shared/Publisher/Add/index.stories.tsx | 12 ++++++++ .../Publisher/{Add.tsx => Add/index.tsx} | 0 .../@shared/Publisher/index.stories.tsx | 28 +++++++++++++++++ src/components/@shared/Publisher/index.tsx | 12 ++++---- 12 files changed, 122 insertions(+), 20 deletions(-) create mode 100644 src/components/@shared/Pagination/index.stories.tsx rename src/components/@shared/Publisher/{Add.module.css => Add/index.module.css} (100%) create mode 100644 src/components/@shared/Publisher/Add/index.stories.tsx rename src/components/@shared/Publisher/{Add.tsx => Add/index.tsx} (100%) create mode 100644 src/components/@shared/Publisher/index.stories.tsx diff --git a/src/@context/MarketMetadata/index.tsx b/src/@context/MarketMetadata/index.tsx index a9e2145b9..5bd17e124 100644 --- a/src/@context/MarketMetadata/index.tsx +++ b/src/@context/MarketMetadata/index.tsx @@ -36,9 +36,9 @@ function MarketMetadataProvider({ opcData.push({ chainId: appConfig.chainIdsSupported[i], - approvedTokens: response.data?.opc.approvedTokens?.map((x) => x.id), - swapApprovedFee: response.data?.opc.swapOceanFee, - swapNotApprovedFee: response.data?.opc.swapNonOceanFee + approvedTokens: response?.data?.opc.approvedTokens?.map((x) => x.id), + swapApprovedFee: response?.data?.opc.swapOceanFee, + swapNotApprovedFee: response?.data?.opc.swapNonOceanFee } as OpcFee) } setOpcFees(opcData) diff --git a/src/components/@shared/AssetList/AssetComputeList/index.stories.tsx b/src/components/@shared/AssetList/AssetComputeList/index.stories.tsx index e6c90db1b..eef8c0009 100644 --- a/src/components/@shared/AssetList/AssetComputeList/index.stories.tsx +++ b/src/components/@shared/AssetList/AssetComputeList/index.stories.tsx @@ -3,11 +3,8 @@ import { ComponentStory, ComponentMeta } from '@storybook/react' import AssetComputeList, { AssetComputeListProps } from '@shared/AssetList/AssetComputeList' -import { - assetSelectionAsset, - locale, - prices -} from '../../../../../.storybook/__mockdata__' +import { assetSelectionAsset } from '../../../../../.storybook/__mockdata__' +import MarketMetadataProvider from '@context/MarketMetadata' export default { title: 'Component/@shared/AssetList/AssetComputeList', @@ -16,7 +13,13 @@ export default { const Template: ComponentStory = ( args: AssetComputeListProps -) => +) => { + return ( + + + + ) +} interface Props { args: AssetComputeListProps diff --git a/src/components/@shared/AssetList/AssetListTitle/index.stories.tsx b/src/components/@shared/AssetList/AssetListTitle/index.stories.tsx index 9a812a009..ee4ac699e 100644 --- a/src/components/@shared/AssetList/AssetListTitle/index.stories.tsx +++ b/src/components/@shared/AssetList/AssetListTitle/index.stories.tsx @@ -3,7 +3,7 @@ import { ComponentStory, ComponentMeta } from '@storybook/react' import AssetListTitle, { AssetListTitleProps } from '@shared/AssetList/AssetListTitle' -import { asset } from '../../../../../.storybook/__mockdata__' +import MarketMetadataProvider from '@context/MarketMetadata' export default { title: 'Component/@shared/AssetList/AssetListTitle', @@ -12,7 +12,13 @@ export default { const Template: ComponentStory = ( args: AssetListTitleProps -) => +) => { + return ( + + + + ) +} interface Props { args: AssetListTitleProps diff --git a/src/components/@shared/FormFields/AssetSelection/index.stories.tsx b/src/components/@shared/FormFields/AssetSelection/index.stories.tsx index f1943440d..e0bbba72b 100644 --- a/src/components/@shared/FormFields/AssetSelection/index.stories.tsx +++ b/src/components/@shared/FormFields/AssetSelection/index.stories.tsx @@ -4,6 +4,8 @@ import AssetSelection, { AssetSelectionProps } from '@shared/FormFields/AssetSelection' import { assetSelectionAsset } from '../../../../../.storybook/__mockdata__' +import MarketMetadataProvider from '@context/MarketMetadata' +import { UserPreferencesProvider } from '@context/UserPreferences' export default { title: 'Component/@shared/FormFields/AssetSelection', @@ -12,8 +14,15 @@ export default { const Template: ComponentStory = ( args: AssetSelectionProps -) => - +) => { + return ( + + + + + + ) +} interface Props { args: AssetSelectionProps } diff --git a/src/components/@shared/Page/index.stories.tsx b/src/components/@shared/Page/index.stories.tsx index 045c32a65..ec092d84f 100644 --- a/src/components/@shared/Page/index.stories.tsx +++ b/src/components/@shared/Page/index.stories.tsx @@ -24,3 +24,16 @@ Default.args = { ) } + +export const WithDescription: Props = Template.bind({}) +WithDescription.args = { + ...Default.args, + description: + 'Data owners and consumers use Ocean Market app to publish, discover, and consume data in a secure, privacy-preserving fashion. OCEAN holders stake liquidity to data pools.' +} + +export const WithTitle: Props = Template.bind({}) +WithTitle.args = { + ...WithDescription.args, + title: 'Ocean Market' +} diff --git a/src/components/@shared/Pagination/index.stories.tsx b/src/components/@shared/Pagination/index.stories.tsx new file mode 100644 index 000000000..927a2c9ca --- /dev/null +++ b/src/components/@shared/Pagination/index.stories.tsx @@ -0,0 +1,30 @@ +import React from 'react' +import { ComponentStory, ComponentMeta } from '@storybook/react' +import Pagination from '@shared/Pagination' +import { PaginationProps } from './_types' +import { UserPreferencesProvider } from '@context/UserPreferences' +import MarketMetadataProvider from '@context/MarketMetadata' + +export default { + title: 'Component/@shared/Pagination', + component: Pagination +} as ComponentMeta + +const Template: ComponentStory = (args: PaginationProps) => { + return ( + + + + ) +} + +interface Props { + args: PaginationProps +} + +export const Default: Props = Template.bind({}) +Default.args = { + totalPages: 10, + currentPage: 1, + rowsPerPage: 3 +} diff --git a/src/components/@shared/Price/PriceUnit/index.stories.tsx b/src/components/@shared/Price/PriceUnit/index.stories.tsx index 54c82dae5..ee061b012 100644 --- a/src/components/@shared/Price/PriceUnit/index.stories.tsx +++ b/src/components/@shared/Price/PriceUnit/index.stories.tsx @@ -1,9 +1,8 @@ import React from 'react' import { ComponentStory, ComponentMeta } from '@storybook/react' import PriceUnit, { PriceUnitProps } from '@shared/Price/PriceUnit' -import MarketMetadataProvider from '@context/MarketMetadata' -import PricesProvider from '@context/Prices' import { UserPreferencesProvider } from '@context/UserPreferences' +import MarketMetadataProvider from '@context/MarketMetadata' export default { title: 'Component/@shared/Price/PriceUnit', diff --git a/src/components/@shared/Publisher/Add.module.css b/src/components/@shared/Publisher/Add/index.module.css similarity index 100% rename from src/components/@shared/Publisher/Add.module.css rename to src/components/@shared/Publisher/Add/index.module.css diff --git a/src/components/@shared/Publisher/Add/index.stories.tsx b/src/components/@shared/Publisher/Add/index.stories.tsx new file mode 100644 index 000000000..fd05fee68 --- /dev/null +++ b/src/components/@shared/Publisher/Add/index.stories.tsx @@ -0,0 +1,12 @@ +import React from 'react' +import { ComponentStory, ComponentMeta } from '@storybook/react' +import Add from '@shared/Publisher/Add' + +export default { + title: 'Component/@shared/Add', + component: Add +} as ComponentMeta + +const Template: ComponentStory = () => + +export const Default = Template.bind({}) diff --git a/src/components/@shared/Publisher/Add.tsx b/src/components/@shared/Publisher/Add/index.tsx similarity index 100% rename from src/components/@shared/Publisher/Add.tsx rename to src/components/@shared/Publisher/Add/index.tsx diff --git a/src/components/@shared/Publisher/index.stories.tsx b/src/components/@shared/Publisher/index.stories.tsx new file mode 100644 index 000000000..526474ec8 --- /dev/null +++ b/src/components/@shared/Publisher/index.stories.tsx @@ -0,0 +1,28 @@ +import React from 'react' +import { ComponentStory, ComponentMeta } from '@storybook/react' +import Publisher, { PublisherProps } from '@shared/Publisher' +import MarketMetadataProvider from '@context/MarketMetadata' + +export default { + title: 'Component/@shared/Publisher', + component: Publisher +} as ComponentMeta + +const Template: ComponentStory = (args: PublisherProps) => ( + +) + +interface Props { + args: PublisherProps +} + +export const Default: Props = Template.bind({}) +Default.args = { + account: '0x134B4eDd7dE8Ea003E721e7670800BA97D9AF1fd' +} + +export const MinimalProfile: Props = Template.bind({}) +MinimalProfile.args = { + account: '0x134B4eDd7dE8Ea003E721e7670800BA97D9AF1fd', + minimal: true +} diff --git a/src/components/@shared/Publisher/index.tsx b/src/components/@shared/Publisher/index.tsx index 0eecd5fa0..c9e56cd11 100644 --- a/src/components/@shared/Publisher/index.tsx +++ b/src/components/@shared/Publisher/index.tsx @@ -10,15 +10,17 @@ import { useIsMounted } from '@hooks/useIsMounted' const cx = classNames.bind(styles) +export interface PublisherProps { + account: string + minimal?: boolean + className?: string +} + export default function Publisher({ account, minimal, className -}: { - account: string - minimal?: boolean - className?: string -}): ReactElement { +}: PublisherProps): ReactElement { const isMounted = useIsMounted() const [profile, setProfile] = useState() const [name, setName] = useState('')