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 { HeaderContainer } from './HeaderContainer';
|
|
|
|
import { Breadcrumbs } from './Breadcrumbs';
|
|
|
|
import { HeaderTitle } from './HeaderTitle';
|
2021-12-14 19:14:53 +00:00
|
|
|
|
|
|
|
export default {
|
2021-12-30 15:46:12 +00:00
|
|
|
component: HeaderContainer,
|
|
|
|
title: 'Components/PageHeader/HeaderContainer',
|
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
|
|
|
<HeaderContainer>
|
2021-12-14 19:14:53 +00:00
|
|
|
<HeaderTitle title={title} />
|
2022-08-12 03:47:56 +00:00
|
|
|
|
|
|
|
<Breadcrumbs
|
|
|
|
breadcrumbs={[
|
|
|
|
{ link: 'example', label: 'crumb1' },
|
|
|
|
{ label: 'crumb2' },
|
|
|
|
]}
|
|
|
|
/>
|
2021-12-30 15:46:12 +00:00
|
|
|
</HeaderContainer>
|
2021-12-14 19:14:53 +00:00
|
|
|
</UserContext.Provider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export const Primary: Story<StoryProps> = Template.bind({});
|
|
|
|
Primary.args = {
|
|
|
|
title: 'Container details',
|
|
|
|
};
|