mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
markdown and network name stories
This commit is contained in:
parent
faf87d65a0
commit
e206cd7f70
21
src/components/@shared/Markdown/index.stories.tsx
Normal file
21
src/components/@shared/Markdown/index.stories.tsx
Normal file
@ -0,0 +1,21 @@
|
||||
import React from 'react'
|
||||
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
||||
import Markdown, { MarkdownProps } from '@shared/Markdown'
|
||||
|
||||
export default {
|
||||
title: 'Component/@shared/Markdown',
|
||||
component: Markdown
|
||||
} as ComponentMeta<typeof Markdown>
|
||||
|
||||
const Template: ComponentStory<typeof Markdown> = (args: MarkdownProps) => (
|
||||
<Markdown {...args} />
|
||||
)
|
||||
|
||||
interface Props {
|
||||
args: MarkdownProps
|
||||
}
|
||||
|
||||
export const Default: Props = Template.bind({})
|
||||
Default.args = {
|
||||
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
|
||||
}
|
@ -2,13 +2,12 @@ import { markdownToHtml } from '@utils/markdown'
|
||||
import React, { ReactElement } from 'react'
|
||||
import styles from './index.module.css'
|
||||
|
||||
const Markdown = ({
|
||||
text,
|
||||
className
|
||||
}: {
|
||||
export interface MarkdownProps {
|
||||
text: string
|
||||
className?: string
|
||||
}): ReactElement => {
|
||||
}
|
||||
|
||||
const Markdown = ({ text, className }: MarkdownProps): ReactElement => {
|
||||
const content = markdownToHtml(text)
|
||||
|
||||
return (
|
||||
|
@ -0,0 +1,21 @@
|
||||
import React from 'react'
|
||||
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
||||
import { NetworkIcon, NetworkIconProps } from '@shared/NetworkName/NetworkIcon'
|
||||
|
||||
export default {
|
||||
title: 'Component/@shared/NetworkIcon',
|
||||
component: NetworkIcon
|
||||
} as ComponentMeta<typeof NetworkIcon>
|
||||
|
||||
const Template: ComponentStory<typeof NetworkIcon> = (
|
||||
args: NetworkIconProps
|
||||
) => <NetworkIcon {...args} />
|
||||
|
||||
interface Props {
|
||||
args: NetworkIconProps
|
||||
}
|
||||
|
||||
export const Default: Props = Template.bind({})
|
||||
Default.args = {
|
||||
name: 'Polygon'
|
||||
}
|
@ -4,9 +4,13 @@ import PolygonIcon from '@images/polygon.svg'
|
||||
import MoonbeamIcon from '@images/moonbeam.svg'
|
||||
import BscIcon from '@images/bsc.svg'
|
||||
import EnergywebIcon from '@images/energyweb.svg'
|
||||
import styles from './index.module.css'
|
||||
import styles from '../index.module.css'
|
||||
|
||||
export function NetworkIcon({ name }: { name: string }): ReactElement {
|
||||
export interface NetworkIconProps {
|
||||
name: string
|
||||
}
|
||||
|
||||
export function NetworkIcon({ name }: NetworkIconProps): ReactElement {
|
||||
const IconMapped = name.includes('ETH')
|
||||
? EthIcon
|
||||
: name.includes('Polygon')
|
27
src/components/@shared/NetworkName/index.stories.tsx
Normal file
27
src/components/@shared/NetworkName/index.stories.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import React from 'react'
|
||||
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
||||
import NetworkName, { NetworkNameProps } from '@shared/NetworkName'
|
||||
|
||||
export default {
|
||||
title: 'Component/@shared/NetworkName',
|
||||
component: NetworkName
|
||||
} as ComponentMeta<typeof NetworkName>
|
||||
|
||||
const Template: ComponentStory<typeof NetworkName> = (
|
||||
args: NetworkNameProps
|
||||
) => <NetworkName {...args} />
|
||||
|
||||
interface Props {
|
||||
args: NetworkNameProps
|
||||
}
|
||||
|
||||
export const Default: Props = Template.bind({})
|
||||
Default.args = {
|
||||
networkId: 1287
|
||||
}
|
||||
|
||||
export const Minimal: Props = Template.bind({})
|
||||
Minimal.args = {
|
||||
networkId: 1287,
|
||||
minimal: true
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user