import { ActionsGear, ActionsRedo, ActionsRefresh, ActionsUndo } from '@repay/cactus-icons'
import React from 'react'
import { ActionBar, Flex, Layout, Link, Text } from '../'
import { actions, ActionWrap, Story } from '../helpers/storybook'
const Undo = () => (
Undo
)
const SimpleRouter = () => {
const [page, setPage] = React.useState<1 | 2>(1)
const [refreshCount, setCount] = React.useState(0)
const onClick = (e: React.MouseEvent) => {
e.preventDefault()
setPage((p) => (p === 1 ? 2 : 1))
}
if (page === 1) {
return (
Go to page 2
)
}
return (
}
aria-label="Refresh"
orderHint="high"
onClick={() => setCount((c) => c + 1)}
/>
Go to page 1
Page refreshed {refreshCount} times.
)
}
export default {
title: 'ActionBar',
component: ActionBar,
argTypes: actions({ name: 'onClick', wrapper: true }),
} as const
type ClickArg = { onClick: ActionWrap }
export const BasicUsage: Story = ({ hasItems, onClick }) => (
{hasItems && (
<>
} aria-label="Redo" onClick={onClick('redo')} />
} aria-label="Undo" onClick={onClick('undo')} />
>
)}
)
BasicUsage.argTypes = { hasItems: { name: 'Has Items' } }
BasicUsage.args = { hasItems: true }
export const WithProvider: Story = ({
hasActionBar,
onClick,
}) => (
{hasActionBar && (
}
onClick={onClick('gear')}
aria-label="Gear up"
/>
)}
)
WithProvider.argTypes = { hasActionBar: { name: 'Has ActionBar' } }
WithProvider.args = { hasActionBar: true }