2021-12-14 19:14:53 +00:00
|
|
|
import { Meta, Story } from '@storybook/react';
|
2021-12-16 18:52:54 +00:00
|
|
|
import { useMemo } from 'react';
|
2021-12-14 19:14:53 +00:00
|
|
|
|
2022-11-13 08:10:18 +00:00
|
|
|
import { UserContext } from '@/react/hooks/useUser';
|
2021-12-14 19:14:53 +00:00
|
|
|
import { UserViewModel } from '@/portainer/models/user';
|
|
|
|
|
2021-12-30 15:46:12 +00:00
|
|
|
import { PageHeader } from './PageHeader';
|
2021-12-14 19:14:53 +00:00
|
|
|
|
|
|
|
export default {
|
2021-12-30 15:46:12 +00:00
|
|
|
component: PageHeader,
|
|
|
|
title: 'Components/PageHeader',
|
2021-12-14 19:14:53 +00:00
|
|
|
} as Meta;
|
|
|
|
|
|
|
|
interface StoryProps {
|
|
|
|
title: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
function Template({ title }: StoryProps) {
|
2021-12-16 18:52:54 +00:00
|
|
|
const state = useMemo(
|
|
|
|
() => ({ user: new UserViewModel({ Username: 'test' }) }),
|
|
|
|
[]
|
|
|
|
);
|
|
|
|
|
2021-12-14 19:14:53 +00:00
|
|
|
return (
|
2021-12-16 18:52:54 +00:00
|
|
|
<UserContext.Provider value={state}>
|
2021-12-30 15:46:12 +00:00
|
|
|
<PageHeader
|
|
|
|
title={title}
|
|
|
|
breadcrumbs={[
|
|
|
|
{ link: 'example', label: 'bread1' },
|
|
|
|
{ link: 'example2', label: 'bread2' },
|
|
|
|
{ label: 'bread3' },
|
|
|
|
{ label: 'bread4' },
|
|
|
|
]}
|
|
|
|
/>
|
2021-12-14 19:14:53 +00:00
|
|
|
</UserContext.Provider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export const Primary: Story<StoryProps> = Template.bind({});
|
|
|
|
Primary.args = {
|
|
|
|
title: 'Container details',
|
|
|
|
};
|