aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/navbar/navbar.stories.tsx
blob: fef995e7f1d77b565554460e95d737dc6a595141 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import type { ComponentMeta, ComponentStory } from '@storybook/react';
import { Navbar as NavbarComponent } from './navbar';

/**
 * Navbar - Storybook Meta
 */
export default {
  title: 'Organisms/Navbar',
  component: NavbarComponent,
  args: {
    searchPage: '#',
  },
  argTypes: {
    nav: {
      description: 'The main nav items.',
      type: {
        name: 'object',
        required: true,
        value: {},
      },
    },
    searchPage: {
      control: {
        type: 'text',
      },
      description: 'The search results page url.',
      type: {
        name: 'string',
        required: true,
      },
    },
  },
  parameters: {
    layout: 'fullscreen',
  },
} as ComponentMeta<typeof NavbarComponent>;

const Template: ComponentStory<typeof NavbarComponent> = (args) => (
  <NavbarComponent {...args} />
);

const doNothing = () => {
  // do nothing;
};

/**
 * Navbar Stories - With all items inactive
 */
export const NavbarInactiveItems = Template.bind({});
NavbarInactiveItems.args = {
  items: [
    {
      icon: 'hamburger',
      id: 'main-nav',
      isActive: false,
      label: 'Nav',
      contents: 'Main nav contents',
      onToggle: doNothing,
    },
    {
      icon: 'magnifying-glass',
      id: 'search',
      isActive: false,
      label: 'Search',
      contents: 'Search contents',
      onToggle: doNothing,
    },
    {
      icon: 'cog',
      id: 'settings',
      isActive: false,
      label: 'Settings',
      contents: 'Settings contents',
      onToggle: doNothing,
    },
  ],
};

/**
 * Navbar Stories - With one item active
 */
export const NavbarActiveItem = Template.bind({});
NavbarActiveItem.args = {
  items: [
    {
      icon: 'hamburger',
      id: 'main-nav',
      isActive: true,
      label: 'Nav',
      contents: 'Main nav contents',
      onToggle: doNothing,
    },
    {
      icon: 'magnifying-glass',
      id: 'search',
      isActive: false,
      label: 'Search',
      contents: 'Search contents',
      onToggle: doNothing,
    },
    {
      icon: 'cog',
      id: 'settings',
      isActive: false,
      label: 'Settings',
      contents: 'Settings contents',
      onToggle: doNothing,
    },
  ],
};