@altinn/altinn-components 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/.github/workflows/ci-cd-main.yml +5 -2
  2. package/.github/workflows/workflow-deploy-storybook.yml +35 -0
  3. package/.storybook/StoryDecorator.tsx +10 -8
  4. package/CHANGELOG.md +14 -0
  5. package/README.md +20 -2
  6. package/lib/components/Attachment/AttachmentLink.stories.ts +0 -2
  7. package/lib/components/Avatar/avatar.stories.tsx +1 -0
  8. package/lib/components/Button/IconButton.tsx +21 -0
  9. package/lib/components/Button/buttonBase.module.css +17 -2
  10. package/lib/components/Button/iconButton.module.css +14 -0
  11. package/lib/components/Button/index.ts +1 -0
  12. package/lib/components/ContextMenu/ContextMenu.tsx +2 -2
  13. package/lib/components/Dialog/Dialog.stories.ts +6 -2
  14. package/lib/components/Dialog/Dialog.tsx +13 -5
  15. package/lib/components/Dialog/DialogAttachments.stories.ts +0 -2
  16. package/lib/components/Dialog/DialogContent.tsx +0 -1
  17. package/lib/components/Dialog/DialogHeader.stories.ts +0 -2
  18. package/lib/components/Dialog/DialogListItem.tsx +3 -0
  19. package/lib/components/Dialog/DialogMetadata.stories.ts +0 -2
  20. package/lib/components/Dialog/DialogNav.stories.ts +0 -2
  21. package/lib/components/Dialog/DialogNav.tsx +6 -6
  22. package/lib/components/Dialog/DialogSeenBy.stories.tsx +5 -7
  23. package/lib/components/Dialog/DialogTitle.stories.ts +0 -2
  24. package/lib/components/Dialog/dialogListItemBase.module.css +1 -1
  25. package/lib/components/Dropdown/Backdrop.tsx +11 -0
  26. package/lib/components/Dropdown/DrawerBase.tsx +17 -0
  27. package/lib/components/Dropdown/DropdownBase.tsx +17 -0
  28. package/lib/components/Dropdown/backdrop.module.css +8 -0
  29. package/lib/components/Dropdown/drawerBase.module.css +8 -0
  30. package/lib/components/Dropdown/dropdownBase.module.css +18 -0
  31. package/lib/components/Dropdown/index.ts +3 -0
  32. package/lib/components/{Header → GlobalMenu}/GlobalMenu.stories.tsx +1 -13
  33. package/lib/components/{Header → GlobalMenu}/GlobalMenu.tsx +14 -23
  34. package/lib/components/GlobalMenu/index.tsx +1 -0
  35. package/lib/components/Header/Header.stories.ts +61 -33
  36. package/lib/components/Header/Header.tsx +43 -17
  37. package/lib/components/Header/HeaderBase.tsx +10 -3
  38. package/lib/components/Header/HeaderButton.stories.ts +16 -0
  39. package/lib/components/Header/HeaderButton.tsx +12 -0
  40. package/lib/components/Header/HeaderMenu.tsx +17 -0
  41. package/lib/components/Header/header.module.css +51 -13
  42. package/lib/components/Header/headerBase.module.css +8 -0
  43. package/lib/components/Header/headerButton.module.css +1 -0
  44. package/lib/components/Header/headerMenu.module.css +3 -0
  45. package/lib/components/Header/index.tsx +0 -1
  46. package/lib/components/Layout/Layout.stories.tsx +236 -0
  47. package/lib/components/Layout/Layout.tsx +9 -7
  48. package/lib/components/Layout/LayoutBase.tsx +1 -1
  49. package/lib/components/Layout/LayoutBody.tsx +1 -1
  50. package/lib/components/Layout/LayoutContent.tsx +1 -1
  51. package/lib/components/Layout/LayoutSidebar.tsx +11 -4
  52. package/lib/components/Layout/layoutBase.module.css +23 -0
  53. package/lib/components/Layout/layoutBody.module.css +14 -0
  54. package/lib/components/Layout/layoutContent.module.css +8 -0
  55. package/lib/components/Layout/layoutSidebar.module.css +19 -0
  56. package/lib/components/LayoutAction/ActionFooter.stories.tsx +70 -0
  57. package/lib/components/LayoutAction/ActionFooter.tsx +15 -0
  58. package/lib/components/LayoutAction/ActionHeader.stories.ts +20 -0
  59. package/lib/components/LayoutAction/ActionHeader.tsx +19 -0
  60. package/lib/components/LayoutAction/ActionMenu.stories.tsx +39 -0
  61. package/lib/components/LayoutAction/ActionMenu.tsx +22 -0
  62. package/lib/components/LayoutAction/actionFooter.module.css +28 -0
  63. package/lib/components/LayoutAction/actionHeader.module.css +55 -0
  64. package/lib/components/LayoutAction/actionMenu.module.css +25 -0
  65. package/lib/components/LayoutAction/index.ts +3 -0
  66. package/lib/components/Menu/MenuBase.tsx +4 -2
  67. package/lib/components/Menu/MenuItemBase.tsx +5 -3
  68. package/lib/components/RootProvider/RootProvider.tsx +19 -0
  69. package/lib/components/RootProvider/index.ts +1 -0
  70. package/lib/components/Snackbar/Snackbar.stories.tsx +21 -0
  71. package/lib/components/Snackbar/Snackbar.tsx +32 -0
  72. package/lib/components/Snackbar/SnackbarBase.tsx +39 -0
  73. package/lib/components/Snackbar/SnackbarLabel.tsx +10 -0
  74. package/lib/components/Snackbar/SnackbarMedia.tsx +14 -0
  75. package/lib/components/Snackbar/index.ts +4 -0
  76. package/lib/components/Snackbar/snackbarBase.module.css +55 -0
  77. package/lib/components/Snackbar/snackbarLabel.module.css +6 -0
  78. package/lib/components/Snackbar/snackbarMedia.module.css +10 -0
  79. package/lib/components/Toolbar/ToolbarAdd.stories.ts +0 -2
  80. package/lib/components/Toolbar/ToolbarFilter.stories.ts +0 -2
  81. package/lib/components/index.ts +4 -0
  82. package/package.json +1 -1
  83. package/lib/components/Layout/Layout.stories.ts +0 -124
  84. package/lib/components/Layout/layout.module.css +0 -63
  85. /package/lib/components/Header/{globalMenu.module.css → mobileMenu.module.css} +0 -0
@@ -1,3 +1,4 @@
1
+ name: CI/CD Main
1
2
  on:
2
3
  push:
3
4
  branches:
@@ -6,10 +7,12 @@ on:
6
7
  permissions:
7
8
  contents: write
8
9
  pull-requests: write
9
-
10
- name: release-please
10
+ pages: write
11
+ id-token: write
11
12
 
12
13
  jobs:
14
+ deploy-documentation:
15
+ uses: ./.github/workflows/workflow-deploy-storybook.yml
13
16
  release-please:
14
17
  runs-on: ubuntu-latest
15
18
  steps:
@@ -0,0 +1,35 @@
1
+ name: Deploy Storybook to GitHub Pages
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ workflow_call:
6
+
7
+ permissions:
8
+ contents: read
9
+ pages: write
10
+ id-token: write
11
+
12
+ concurrency:
13
+ group: "pages"
14
+ cancel-in-progress: false
15
+
16
+ jobs:
17
+ deploy:
18
+ environment:
19
+ name: github-pages
20
+ url: ${{ steps.deployment.outputs.page_url }}
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+ - name: Setup PNPM
26
+ uses: pnpm/action-setup@v2
27
+ - run: pnpm install --frozen-lockfile
28
+ - run: pnpm build-storybook
29
+ - name: Upload artifact
30
+ uses: actions/upload-pages-artifact@v3
31
+ with:
32
+ path: "./storybook-static"
33
+ - name: Deploy to GitHub Pages
34
+ id: deployment
35
+ uses: actions/deploy-pages@v4
@@ -1,5 +1,6 @@
1
- import { ReactNode } from "react";
1
+ import {ReactNode} from "react";
2
2
  import styles from "./storyDecorator.module.css";
3
+ import {RootProvider} from "../lib/components/RootProvider/";
3
4
 
4
5
  interface StoryDecoratorProps {
5
6
  tags: string[];
@@ -16,12 +17,13 @@ export const StoryDecorator = ({
16
17
  const state = isStable ? "stable" : "experimental";
17
18
 
18
19
  return (
19
- <div className={styles.preview} data-theme={theme}>
20
- <span className={styles.tag} data-tag={state}>
21
- {state}
22
- </span>
23
-
24
- <div className={styles.component}>{children}</div>
25
- </div>
20
+ <RootProvider>
21
+ <div className={styles.preview} data-theme={theme}>
22
+ <div className={styles.component}>{children}</div>
23
+ <span className={styles.tag} data-tag={state}>
24
+ {state}
25
+ </span>
26
+ </div>
27
+ </RootProvider>
26
28
  );
27
29
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.0](https://github.com/Altinn/altinn-components/compare/v0.2.2...v0.3.0) (2024-11-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * add snackbar and bulk operation action components ([#38](https://github.com/Altinn/altinn-components/issues/38)) ([a39178d](https://github.com/Altinn/altinn-components/commit/a39178d060819e6943b1d1a5632832529b8f4165))
9
+
10
+ ## [0.2.2](https://github.com/Altinn/altinn-components/compare/v0.2.1...v0.2.2) (2024-11-06)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * dialog-props ([#28](https://github.com/Altinn/altinn-components/issues/28)) ([59b6a8f](https://github.com/Altinn/altinn-components/commit/59b6a8fb04abece013218402587f93863c1b9012))
16
+
3
17
  ## [0.2.1](https://github.com/Altinn/altinn-components/compare/v0.2.0...v0.2.1) (2024-11-06)
4
18
 
5
19
 
package/README.md CHANGED
@@ -17,7 +17,25 @@ pnpm add @altinn/components
17
17
  ```
18
18
  Tested with Node.js 20.x <
19
19
 
20
+ ## Requirements
21
+
22
+ React `>=18`in your project.
23
+
20
24
  ## Usage
25
+ Wrap your application in RootProvider to enable shared context across all components. Here’s a basic setup:
26
+
27
+ ```tsx
28
+ import { RootProvider } from '@altinn/components';
29
+
30
+ function App() {
31
+ return (
32
+ <RootProvider>
33
+ { /* Your application here */ }
34
+ </RootProvider>
35
+ );
36
+ }
37
+ ```
38
+
21
39
  To use the components in your application, you need to import the components you want to use from the package. For example:
22
40
 
23
41
  ```tsx
@@ -26,9 +44,9 @@ import { Avatar, type AvatarVariant } from '@altinn/components';
26
44
  ```
27
45
  and import the css file in your application once:
28
46
  ```ts
29
- import '@altinn/components/dist/index.css';
47
+ import '@altinn/altinn-components/lib/css/global.css';
30
48
  ```
31
49
  for correct `font-family` and minimal collection of resets.
32
50
 
33
51
  ## Documentation
34
- The documentation for the components can be found in the storybook, cf. [TODO ADD Storybook]()
52
+ The documentation for the components can be found in the [Storybook](https://altinn.github.io/altinn-components)
@@ -1,6 +1,4 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
-
4
2
  import { AttachmentLink } from './AttachmentLink';
5
3
 
6
4
  const meta = {
@@ -33,6 +33,7 @@ export const Company: Story = {
33
33
 
34
34
  export const Logo: Story = {
35
35
  args: {
36
+ type: 'company',
36
37
  imageUrl: 'https://avatars.githubusercontent.com/u/1536293?s=200&v=4',
37
38
  size: 'xl',
38
39
  },
@@ -0,0 +1,21 @@
1
+ import cx from 'classnames';
2
+ import { ButtonBase, type ButtonColor, type ButtonSize, type ButtonVariant } from '../Button';
3
+ import { Icon, type IconName } from '../Icon';
4
+ import styles from './iconButton.module.css';
5
+
6
+ interface IconButtonProps {
7
+ icon: IconName;
8
+ color?: ButtonColor;
9
+ size?: ButtonSize;
10
+ variant?: ButtonVariant;
11
+ className?: string;
12
+ onClick?: () => void;
13
+ }
14
+
15
+ export const IconButton = ({ className, variant, color, size, icon, onClick }: IconButtonProps) => {
16
+ return (
17
+ <ButtonBase variant={variant} color={color} size={size} className={cx(styles.button, className)} onClick={onClick}>
18
+ <Icon name={icon} className={styles.icon} />
19
+ </ButtonBase>
20
+ );
21
+ };
@@ -56,14 +56,12 @@
56
56
  /* outline */
57
57
 
58
58
  .button[data-variant="outline"] {
59
- border-color: var(--theme-base-hover);
60
59
  border-style: solid;
61
60
  }
62
61
 
63
62
  /* dotted */
64
63
 
65
64
  .button[data-variant="dotted"] {
66
- border-color: var(--theme-base-hover);
67
65
  border-style: dotted;
68
66
  }
69
67
 
@@ -78,6 +76,23 @@
78
76
  color: var(--theme-text-default);
79
77
  }
80
78
 
79
+ /* primary color */
80
+
81
+ .button[data-color="primary"] {
82
+ border-color: var(--theme-base-default);
83
+ }
84
+
85
+ .button[data-color="primary"]:hover {
86
+ border-color: var(--theme-base-hover);
87
+ }
88
+
89
+ .button[data-color="primary"][data-variant="solid"],
90
+ .button[data-color="primary"][data-variant="solid"] {
91
+ border-color: var(--theme-base-default);
92
+ background-color: var(--theme-base-default);
93
+ color: white;
94
+ }
95
+
81
96
  /* secondary color */
82
97
 
83
98
  .button[data-color="secondary"] {
@@ -0,0 +1,14 @@
1
+ .button {
2
+ border: 1px solid;
3
+ width: 2.75rem;
4
+ height: 2.75rem;
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+ border-radius: 2px;
9
+ }
10
+
11
+ .icon {
12
+ font-size: 1.5rem;
13
+ margin: 0.625rem;
14
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './ButtonBase';
2
2
  export * from './Button';
3
3
  export * from './ComboButton';
4
+ export * from './IconButton';
@@ -4,7 +4,7 @@ import { Icon } from '../Icon';
4
4
  import { Menu, type MenuGroups, type MenuItemProps } from '../Menu';
5
5
  import styles from './contextMenu.module.css';
6
6
 
7
- export interface DialogContextMenuProps {
7
+ export interface ContextMenuProps {
8
8
  onToggle?: MouseEventHandler;
9
9
  label: string;
10
10
  value: string | number;
@@ -14,7 +14,7 @@ export interface DialogContextMenuProps {
14
14
  className?: string;
15
15
  }
16
16
 
17
- export const ContextMenu = ({ expanded = true, onToggle, groups = {}, items }: DialogContextMenuProps) => {
17
+ export const ContextMenu = ({ expanded = true, onToggle, groups = {}, items }: ContextMenuProps) => {
18
18
  return (
19
19
  <div className={styles.toggle}>
20
20
  <ButtonBase className={styles.button} as="button" color="secondary" onClick={onToggle}>
@@ -1,6 +1,4 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
-
4
2
  import { Dialog } from './Dialog';
5
3
 
6
4
  const meta = {
@@ -10,7 +8,13 @@ const meta = {
10
8
  parameters: {},
11
9
  argTypes: { body: { control: 'text' } },
12
10
  args: {
11
+ menu: [
12
+ {
13
+ items: [{ label: 'Menu 1' }],
14
+ },
15
+ ],
13
16
  updatedAt: '1999-05-26',
17
+ updatedAtLabel: '26. mai 1999',
14
18
  title: 'Title',
15
19
  summary: 'Summary',
16
20
  },
@@ -9,6 +9,8 @@ import { DialogFooter } from './DialogFooter';
9
9
  import { DialogHeader } from './DialogHeader';
10
10
  import { DialogSeenBy, type DialogSeenByProps } from './DialogSeenBy';
11
11
 
12
+ import type { ContextMenuProps } from '../ContextMenu/';
13
+
12
14
  import type { ReactNode } from 'react';
13
15
  import { type DialogActionButtonProps, DialogActions } from './DialogActions.tsx';
14
16
  import type { DialogRecipientProps, DialogSenderProps } from './DialogHeadings.tsx';
@@ -21,14 +23,18 @@ export interface DialogProps {
21
23
  title: string;
22
24
  /** Back button */
23
25
  backButton?: DialogBackButtonProps;
26
+ /** Context menu */
27
+ menu?: ContextMenuProps;
24
28
  /** Dialog status */
25
29
  status?: DialogStatusProps;
26
30
  /** Updated date time */
27
31
  updatedAt?: string;
28
- /** Latest updated by name */
29
- updatedByName?: string;
32
+ /** Updated label */
33
+ updatedAtLabel?: string;
30
34
  /** Due date */
31
35
  dueAt?: string;
36
+ /** Due at label */
37
+ dueAtLabel?: string;
32
38
  /** Sender */
33
39
  sender?: DialogSenderProps;
34
40
  /** Recipient */
@@ -57,9 +63,11 @@ export interface DialogProps {
57
63
 
58
64
  export const Dialog = ({
59
65
  backButton,
66
+ menu,
60
67
  updatedAt,
61
- updatedByName,
68
+ updatedAtLabel,
62
69
  dueAt,
70
+ dueAtLabel,
63
71
  status,
64
72
  title,
65
73
  sender,
@@ -75,7 +83,7 @@ export const Dialog = ({
75
83
  }: DialogProps) => {
76
84
  return (
77
85
  <DialogBase>
78
- <DialogNav status={status} dueAt={dueAt} backButton={backButton} />
86
+ <DialogNav status={status} dueAt={dueAt} dueAtLabel={dueAtLabel} backButton={backButton} menu={menu} />
79
87
  <DialogArticleBase>
80
88
  <DialogHeader
81
89
  title={title}
@@ -85,7 +93,7 @@ export const Dialog = ({
85
93
  variant="neutral"
86
94
  />
87
95
  <DialogBodyBase>
88
- <DialogContent updatedAt={updatedAt} updatedByName={updatedByName} summary={summary} body={body} />
96
+ <DialogContent updatedAt={updatedAt} updatedAtLabel={updatedAtLabel} summary={summary} body={body} />
89
97
  {attachments && <DialogAttachments {...attachments} />}
90
98
  {actions?.length > 0 && <DialogActions items={actions} />}
91
99
  <MetaBase>
@@ -1,6 +1,4 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
-
4
2
  import { DialogAttachments } from './DialogAttachments';
5
3
 
6
4
  const meta = {
@@ -3,7 +3,6 @@ import { Typography } from '../Typography';
3
3
  import { DialogMetadata } from './DialogMetadata';
4
4
 
5
5
  export interface DialogContentProps {
6
- updatedByName?: string;
7
6
  updatedAt?: string;
8
7
  updatedAtLabel?: string;
9
8
  summary?: string;
@@ -1,6 +1,4 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
-
4
2
  import { DialogHeader } from './DialogHeader';
5
3
 
6
4
  const meta = {
@@ -53,6 +53,8 @@ export type DialogListItemProps = {
53
53
  touchedBy?: DialogTouchedByActor[];
54
54
  /** Number of attachments */
55
55
  attachmentsCount?: number;
56
+ /** OnClick handler */
57
+ onClick?: () => void;
56
58
  };
57
59
 
58
60
  /**
@@ -82,6 +84,7 @@ export const DialogListItem = ({
82
84
  attachmentsCount,
83
85
  title,
84
86
  summary,
87
+ onClick,
85
88
  ...rest
86
89
  }: DialogListItemProps) => {
87
90
  return (
@@ -1,6 +1,4 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
-
4
2
  import { DialogMetadata } from './DialogMetadata';
5
3
 
6
4
  const meta = {
@@ -1,6 +1,4 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
-
4
2
  import { DialogNav } from './DialogNav';
5
3
 
6
4
  const meta = {
@@ -2,7 +2,7 @@
2
2
  import { useState } from 'react';
3
3
  import type { ElementType } from 'react';
4
4
  import { Button } from '../Button';
5
- import { ContextMenu, type DialogContextMenuProps } from '../ContextMenu/ContextMenu.tsx';
5
+ import { ContextMenu, type ContextMenuProps } from '../ContextMenu/ContextMenu.tsx';
6
6
  import { MetaTimestamp } from '../Meta';
7
7
  import { DialogStatus, type DialogStatusProps } from './DialogStatus';
8
8
  import { DialogTouchedBy, type DialogTouchedByActor } from './DialogTouchedBy';
@@ -17,10 +17,10 @@ export interface DialogBackButtonProps {
17
17
  export interface DialogNavProps {
18
18
  status?: DialogStatusProps;
19
19
  dueAt?: string;
20
- duaAtLabel?: string;
20
+ dueAtLabel?: string;
21
21
  touchedBy?: DialogTouchedByActor[];
22
22
  backButton?: DialogBackButtonProps;
23
- menu?: DialogContextMenuProps;
23
+ menu?: ContextMenuProps;
24
24
  }
25
25
 
26
26
  /**
@@ -33,8 +33,8 @@ export const DialogNav = ({
33
33
  },
34
34
  status,
35
35
  dueAt,
36
+ dueAtLabel,
36
37
  touchedBy,
37
- duaAtLabel,
38
38
  menu,
39
39
  }: DialogNavProps) => {
40
40
  const [expandedItem, setexpandedItem] = useState<boolean>(false);
@@ -46,9 +46,9 @@ export const DialogNav = ({
46
46
  {backButton?.label || 'Back'}
47
47
  </Button>
48
48
  <div className={styles.action}>
49
- {duaAtLabel && duaAtLabel && (
49
+ {dueAt && dueAtLabel && (
50
50
  <MetaTimestamp datetime={dueAt} size="xs">
51
- {duaAtLabel}
51
+ {dueAtLabel}
52
52
  </MetaTimestamp>
53
53
  )}
54
54
  {status && <DialogStatus {...status} />}
@@ -1,7 +1,4 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
- import { useState } from 'react';
4
-
5
2
  import { DialogSeenBy } from './DialogSeenBy';
6
3
 
7
4
  const meta = {
@@ -12,6 +9,7 @@ const meta = {
12
9
  args: {
13
10
  seenByEndUser: true,
14
11
  seenByOthersCount: 2,
12
+ label: '',
15
13
  },
16
14
  } satisfies Meta<typeof DialogSeenBy>;
17
15
 
@@ -39,17 +37,17 @@ export const seenByEndUserAndOthers: Story = {
39
37
  },
40
38
  };
41
39
 
42
- export const ExampleLabel = ({ seenByEndUser, seenByOthersCount }) => {
43
- let seen = false;
40
+ export const ExampleLabel = ({
41
+ seenByEndUser,
42
+ seenByOthersCount,
43
+ }: { seenByEndUser: boolean; seenByOthersCount: number }) => {
44
44
  const seenByLabel = [];
45
45
 
46
46
  if (seenByEndUser) {
47
- seen = true;
48
47
  seenByLabel.push('deg');
49
48
  }
50
49
 
51
50
  if (seenByOthersCount) {
52
- seen = true;
53
51
  seenByLabel.push(seenByOthersCount);
54
52
  }
55
53
 
@@ -1,6 +1,4 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
-
4
2
  import { DialogTitle } from './DialogTitle';
5
3
 
6
4
  const meta = {
@@ -7,7 +7,7 @@
7
7
 
8
8
  .item[aria-selected="true"] {
9
9
  background-color: var(--theme-background-subtle);
10
- outline: 1px solid;
10
+ outline: 2px solid;
11
11
  }
12
12
 
13
13
  .link {
@@ -0,0 +1,11 @@
1
+ import cx from 'classnames';
2
+ import styles from './backdrop.module.css';
3
+
4
+ export interface BackdropProps {
5
+ expanded?: boolean;
6
+ className?: string;
7
+ }
8
+
9
+ export const Backdrop = ({ expanded = false, className }: BackdropProps) => {
10
+ return <div className={cx(styles.backdrop, className)} aria-expanded={expanded} />;
11
+ };
@@ -0,0 +1,17 @@
1
+ import cx from 'classnames';
2
+ import type { ReactNode } from 'react';
3
+ import styles from './drawerBase.module.css';
4
+
5
+ export interface DrawerBaseProps {
6
+ expanded?: boolean;
7
+ className?: string;
8
+ children?: ReactNode;
9
+ }
10
+
11
+ export const DrawerBase = ({ expanded = false, className, children }: DrawerBaseProps) => {
12
+ return (
13
+ <div className={cx(styles.drawer, className)} aria-expanded={expanded}>
14
+ {children}
15
+ </div>
16
+ );
17
+ };
@@ -0,0 +1,17 @@
1
+ import cx from 'classnames';
2
+ import type { ReactNode } from 'react';
3
+ import styles from './dropdownBase.module.css';
4
+
5
+ export interface DropdownBaseProps {
6
+ expanded?: boolean;
7
+ className?: string;
8
+ children?: ReactNode;
9
+ }
10
+
11
+ export const DropdownBase = ({ expanded = false, className, children }: DropdownBaseProps) => {
12
+ return (
13
+ <div className={cx(styles.dropdown, className)} aria-expanded={expanded}>
14
+ {children}
15
+ </div>
16
+ );
17
+ };
@@ -0,0 +1,8 @@
1
+ .backdrop {
2
+ background-color: rgba(17, 29, 70, 0.25);
3
+ position: fixed;
4
+ top: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ left: 0;
8
+ }
@@ -0,0 +1,8 @@
1
+ .drawer {
2
+ display: none;
3
+ }
4
+
5
+ .drawer[aria-expanded="true"] {
6
+ display: block;
7
+ width: 100%;
8
+ }
@@ -0,0 +1,18 @@
1
+ .dropdown {
2
+ display: none;
3
+ }
4
+
5
+ .dropdown[aria-expanded="true"] {
6
+ display: block;
7
+ position: absolute;
8
+ right: 0;
9
+ z-index: 2;
10
+ }
11
+
12
+ .dropdown {
13
+ margin-top: 0.5rem;
14
+ padding: 0 0.5rem;
15
+ background-color: var(--neutral-background-default);
16
+ border-radius: 2px;
17
+ box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.1);
18
+ }
@@ -0,0 +1,3 @@
1
+ export * from './DrawerBase';
2
+ export * from './DropdownBase';
3
+ export * from './Backdrop';
@@ -6,9 +6,7 @@ const meta = {
6
6
  title: 'Header/GlobalMenu',
7
7
  component: GlobalMenu,
8
8
  tags: ['autodocs'],
9
- parameters: {
10
- layout: 'centered',
11
- },
9
+ parameters: {},
12
10
  args: {
13
11
  groups: {
14
12
  apps: {
@@ -141,18 +139,8 @@ export const Accounts: Story = {
141
139
  title: 'Deg selv og favoritter',
142
140
  },
143
141
  secondary: {
144
- divider: true,
145
142
  title: 'Andre kontoer',
146
143
  },
147
- favourites: {
148
- divider: true,
149
- },
150
- company: {
151
- divider: true,
152
- },
153
- person: {
154
- divider: true,
155
- },
156
144
  },
157
145
  accounts: [
158
146
  {