mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
AssetType, ButtonBuy and ExplorerLink stories
This commit is contained in:
parent
f4fc47c6d0
commit
ec84d6f69a
22
src/components/@shared/AssetType/index.stories.tsx
Normal file
22
src/components/@shared/AssetType/index.stories.tsx
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
||||||
|
import AssetType, { AssetTypeProps } from '@shared/AssetType'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'Component/@shared/AssetType',
|
||||||
|
component: AssetType
|
||||||
|
} as ComponentMeta<typeof AssetType>
|
||||||
|
|
||||||
|
const Template: ComponentStory<typeof AssetType> = (args: AssetTypeProps) => (
|
||||||
|
<AssetType {...args} />
|
||||||
|
)
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
args: AssetTypeProps
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Default: Props = Template.bind({})
|
||||||
|
Default.args = {
|
||||||
|
type: 'compute',
|
||||||
|
accessType: 'access'
|
||||||
|
}
|
@ -7,15 +7,17 @@ import Lock from '@images/lock.svg'
|
|||||||
|
|
||||||
const cx = classNames.bind(styles)
|
const cx = classNames.bind(styles)
|
||||||
|
|
||||||
|
export interface AssetTypeProps {
|
||||||
|
type: string
|
||||||
|
accessType: string
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
export default function AssetType({
|
export default function AssetType({
|
||||||
type,
|
type,
|
||||||
accessType,
|
accessType,
|
||||||
className
|
className
|
||||||
}: {
|
}: AssetTypeProps): ReactElement {
|
||||||
type: string
|
|
||||||
accessType: string
|
|
||||||
className?: string
|
|
||||||
}): ReactElement {
|
|
||||||
const styleClasses = cx({
|
const styleClasses = cx({
|
||||||
[className]: className
|
[className]: className
|
||||||
})
|
})
|
||||||
|
38
src/components/@shared/ButtonBuy/index.stories.tsx
Normal file
38
src/components/@shared/ButtonBuy/index.stories.tsx
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
||||||
|
import ButtonBuy, { ButtonBuyProps } from '@shared/ButtonBuy'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'Component/@shared/ButtonBuy',
|
||||||
|
component: ButtonBuy
|
||||||
|
} as ComponentMeta<typeof ButtonBuy>
|
||||||
|
|
||||||
|
const Template: ComponentStory<typeof ButtonBuy> = (args: ButtonBuyProps) => (
|
||||||
|
<ButtonBuy {...args} />
|
||||||
|
)
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
args: ButtonBuyProps
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Default: Props = Template.bind({})
|
||||||
|
Default.args = {
|
||||||
|
action: 'compute',
|
||||||
|
disabled: false,
|
||||||
|
hasPreviousOrder: true,
|
||||||
|
hasDatatoken: true,
|
||||||
|
dtSymbol: 'TOPLEN-30',
|
||||||
|
dtBalance: '10',
|
||||||
|
datasetLowPoolLiquidity: true,
|
||||||
|
assetType: 'dataset',
|
||||||
|
assetTimeout: '1 day',
|
||||||
|
isConsumable: true,
|
||||||
|
consumableFeedback: 'ok',
|
||||||
|
isBalanceSufficient: true
|
||||||
|
}
|
||||||
|
|
||||||
|
export const WithType = Template.bind({})
|
||||||
|
WithType.args = {
|
||||||
|
...Default.args,
|
||||||
|
type: 'submit'
|
||||||
|
}
|
@ -3,7 +3,7 @@ import Button from '../atoms/Button'
|
|||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import Loader from '../atoms/Loader'
|
import Loader from '../atoms/Loader'
|
||||||
|
|
||||||
interface ButtonBuyProps {
|
export interface ButtonBuyProps {
|
||||||
action: 'download' | 'compute'
|
action: 'download' | 'compute'
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
hasPreviousOrder: boolean
|
hasPreviousOrder: boolean
|
||||||
|
23
src/components/@shared/ExplorerLink/index.stories.tsx
Normal file
23
src/components/@shared/ExplorerLink/index.stories.tsx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
||||||
|
import ExplorerLink, { ExplorerLinkProps } from '@shared/ExplorerLink'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'Component/@shared/ExplorerLink',
|
||||||
|
component: ExplorerLink
|
||||||
|
} as ComponentMeta<typeof ExplorerLink>
|
||||||
|
|
||||||
|
const Template: ComponentStory<typeof ExplorerLink> = (
|
||||||
|
args: ExplorerLinkProps
|
||||||
|
) => <ExplorerLink {...args} />
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
args: ExplorerLinkProps
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Default: Props = Template.bind({})
|
||||||
|
Default.args = {
|
||||||
|
networkId: 1008,
|
||||||
|
path: 'https://example.com',
|
||||||
|
children: <p>Explorer link</p>
|
||||||
|
}
|
@ -7,17 +7,19 @@ import { getOceanConfig } from '@utils/ocean'
|
|||||||
|
|
||||||
const cx = classNames.bind(styles)
|
const cx = classNames.bind(styles)
|
||||||
|
|
||||||
|
export interface ExplorerLinkProps {
|
||||||
|
networkId: number
|
||||||
|
path: string
|
||||||
|
children: ReactNode
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
export default function ExplorerLink({
|
export default function ExplorerLink({
|
||||||
networkId,
|
networkId,
|
||||||
path,
|
path,
|
||||||
children,
|
children,
|
||||||
className
|
className
|
||||||
}: {
|
}: ExplorerLinkProps): ReactElement {
|
||||||
networkId: number
|
|
||||||
path: string
|
|
||||||
children: ReactNode
|
|
||||||
className?: string
|
|
||||||
}): ReactElement {
|
|
||||||
const [url, setUrl] = useState<string>()
|
const [url, setUrl] = useState<string>()
|
||||||
const [oceanConfig, setOceanConfig] = useState<Config>()
|
const [oceanConfig, setOceanConfig] = useState<Config>()
|
||||||
const styleClasses = cx({
|
const styleClasses = cx({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user