-
Notifications
You must be signed in to change notification settings - Fork 47
/
header.component.stories.ts
83 lines (78 loc) · 3.08 KB
/
header.component.stories.ts
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { Story, Meta } from '@storybook/angular/types-6-0';
import { moduleMetadata, componentWrapperDecorator } from '@storybook/angular';
import { AgModule } from './ag.module';
import { HeaderComponent } from './header.component';
export default {
title: 'AG—Angular (Beta)/Header',
component: HeaderComponent,
decorators: [
// Cannot get preview.js or global decorator solutions to work.
// https://storybook.js.org/tutorials/intro-to-storybook/angular/en/composite-component/
componentWrapperDecorator(
(story) =>
`<div style="font-family: var(--agnostic-font-family-body); line-height: 1.4; font-size: var(--agnostic-body);">${story}</div>`
),
moduleMetadata({
imports: [AgModule],
}),
],
} as Meta;
const Template: Story<HeaderComponent> = (args: HeaderComponent) => ({
template: `<div>
<h3 class="mbe12">Defaults to space between</h3>
<ag-header>
<a href="https://web.dev/">web.dev</a>
<ag-header-nav>
<ag-header-nav-item class="mie12">
<a href="https://css-tricks.com/">CSS-Tricks</a>
</ag-header-nav-item>
<ag-header-nav-item class="mis12 mie16">
<a href="https://developer.mozilla.org/en-US/">MDN</a>
</ag-header-nav-item>
</ag-header-nav>
<a href="https://www.freecodecamp.org/">freeCodeCamp</a>
</ag-header>
</div>`,
});
export const HeaderExample = Template.bind({});
const ContentStart: Story<HeaderComponent> = (args: HeaderComponent) => ({
template: `<div>
<h3 class="mbe12">Header content justify left</h3>
<p class="mbe16">Pass in <code>isHeaderContentStart</code> and apply
<code>flex-fill</code> to the <code>ag-header-nav</code> so it will grow.
</p>
<ag-header isHeaderContentStart="true">
<a href="https://web.dev/">web.dev</a>
<ag-header-nav class="mis16 flex-fill">
<ag-header-nav-item class="mie12">
<a href="https://css-tricks.com/">CSS-Tricks</a>
</ag-header-nav-item>
<ag-header-nav-item class="mis12 mie16">
<a href="https://developer.mozilla.org/en-US/">MDN</a>
</ag-header-nav-item>
</ag-header-nav>
<a href="https://www.freecodecamp.org/">freeCodeCamp</a>
</ag-header></div>`,
});
export const HeaderStart = ContentStart.bind({});
const ContentEnd: Story<HeaderComponent> = (args: HeaderComponent) => ({
template: `<div>
<h3 class="mbe12">Header content justify right</h3>
<p class="mbe16">Pass in <code>isHeaderContentEnd</code> and apply
margins on your child <code>ag-header-nav-item</code>'s as you see
fit.
</p>
<ag-header isHeaderContentEnd="true">
<a class="flex-fill" href="https://web.dev/">web.dev</a>
<ag-header-nav>
<ag-header-nav-item>
<a href="https://css-tricks.com/">CSS-Tricks</a>
</ag-header-nav-item>
<ag-header-nav-item class="mis12 mie16">
<a href="https://developer.mozilla.org/en-US/">MDN</a>
</ag-header-nav-item>
</ag-header-nav>
<a href="https://www.freecodecamp.org/">freeCodeCamp</a>
</ag-header></div>`,
});
export const HeaderEnd = ContentEnd.bind({});