-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathheader.stories.tsx
64 lines (58 loc) · 1.51 KB
/
header.stories.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import type { Meta, StoryObj } from "@storybook/react";
import React from "react";
import { HeaderApp } from "@app/layout/header";
import { MemoryRouter } from "react-router-dom";
import { fn } from "@storybook/test";
import * as actual from "@app/hooks/useBranding";
const useBranding = fn(actual.useBranding).mockName("useBranding");
import { BrandingStrings } from "@trustify-ui/common";
const meta = {
title: "Components/Layout/HeaderApp",
component: HeaderApp,
decorators: [
(Story) => (
<MemoryRouter initialEntries={["/"]}>
<Story />
</MemoryRouter>
),
],
} satisfies Meta<typeof HeaderApp>;
export default meta;
type Story = StoryObj<typeof meta>;
const mockBrandingStrings: BrandingStrings = {
application: {
title: "Mock Trustify",
name: "Mock App",
description: "A description of the mock application.",
},
about: {
displayName: "Mock Trustify Display Name",
imageSrc: "/branding/images/masthead-logo.svg",
documentationUrl: "https://mock-docs.example.com",
},
masthead: {
leftBrand: {
src: "/mock-left-brand.svg",
alt: "Mock Left Brand",
height: "40px",
},
leftTitle: {
text: "Mock Left Title",
heading: "h1",
size: "xl",
},
rightBrand: {
src: "/mock-right-brand.svg",
alt: "Mock Right Brand",
height: "40px",
},
},
};
export const Primary: Story = {
args: {
rightBrand: {},
},
async beforeEach() {
useBranding.mockImplementation(() => mockBrandingStrings);
},
};