Skip to content

Commit

Permalink
Intro to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ingefossland authored and seanes committed Jan 15, 2025
1 parent 9105e75 commit 7ba0c1e
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 56 deletions.
16 changes: 3 additions & 13 deletions lib/components/GlobalMenu/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ElementType } from "react";
import { MenuItem } from "../Menu";
import type { ElementType } from 'react';
import { MenuItem } from '../Menu';

export interface BackButtonProps {
label: string;
Expand All @@ -8,15 +8,5 @@ export interface BackButtonProps {
}

export const BackButton = ({ label, onClick, as }: BackButtonProps) => {
return (
<MenuItem
size="xs"
id="back"
icon="arrow-undo"
theme="transparent"
title={label}
onClick={onClick}
as={as}
/>
);
return <MenuItem size="xs" id="back" icon="arrow-undo" theme="transparent" title={label} onClick={onClick} as={as} />;
};
35 changes: 11 additions & 24 deletions lib/components/GlobalMenu/GlobalMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
"use client";
import { useMemo, useState } from "react";
import {
Menu,
type MenuItemGroups,
type MenuItemProps,
MenuListItem,
} from "../Menu";
import { type Account, AccountButton } from "./AccountButton";
import { AccountMenu, type AccountMenuProps } from "./AccountMenu";
import { BackButton } from "./BackButton";
import {
GlobalMenuBase,
GlobalMenuFooter,
GlobalMenuHeader,
} from "./GlobalMenuBase";
import { LogoutButton, type LogoutButtonProps } from "./LogoutButton";
'use client';
import { useMemo, useState } from 'react';
import { Menu, type MenuItemGroups, type MenuItemProps, MenuListItem } from '../Menu';
import { type Account, AccountButton } from './AccountButton';
import { AccountMenu, type AccountMenuProps } from './AccountMenu';
import { BackButton } from './BackButton';
import { GlobalMenuBase, GlobalMenuFooter, GlobalMenuHeader } from './GlobalMenuBase';
import { LogoutButton, type LogoutButtonProps } from './LogoutButton';

export interface GlobalMenuProps extends AccountMenuProps {
items: MenuItemProps[];
Expand All @@ -35,8 +26,8 @@ export const GlobalMenu = ({
accountSearch,
items = [],
groups,
changeLabel = "Change",
backLabel = "Back",
changeLabel = 'Change',
backLabel = 'Back',
currentAccount,
onSelectAccount,
onClose,
Expand Down Expand Up @@ -95,11 +86,7 @@ export const GlobalMenu = ({
/>
</GlobalMenuHeader>
<MenuListItem as="div" role="separator" />
<Menu
groups={groups}
items={itemsWithToggle}
defaultItemTheme="surface"
/>
<Menu groups={groups} items={itemsWithToggle} defaultItemTheme="surface" />
{logoutButton && (
<>
<MenuListItem as="div" role="separator" />
Expand Down
12 changes: 4 additions & 8 deletions lib/components/Page/PageMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import { MenuItem, type MenuItemColor, type MenuItemProps } from "..";
import { MenuItem, type MenuItemColor, type MenuItemProps } from '..';

import styles from "./pageMenu.module.css";
import styles from './pageMenu.module.css';

export type PageMenuTheme = "transparent" | "base";
export type PageMenuTheme = 'transparent' | 'base';

export interface PageMenuProps {
theme?: PageMenuTheme;
color?: MenuItemColor;
items?: MenuItemProps[];
}

export const PageMenu = ({
theme = "transparent",
color,
items = [],
}: PageMenuProps) => {
export const PageMenu = ({ theme = 'transparent', color, items = [] }: PageMenuProps) => {
return (
<nav data-theme={theme} data-color={color} className={styles.menu}>
<ul className={styles.list}>
Expand Down
55 changes: 44 additions & 11 deletions lib/stories/Demo/docs/Default.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { useNavigation } from '../';
import { Badge, Flex, Heading, PageBase, PageNav, Section, Typography } from '../../../components';
import { Colors } from './Colors';
import { useNavigation } from "../";
import {
Badge,
Flex,
Heading,
PageBase,
PageNav,
Section,
Typography,
} from "../../../components";
import { Colors } from "./Colors";

export const Default = () => {
const { breadcrumbs } = useNavigation();
Expand All @@ -11,27 +19,50 @@ export const Default = () => {
<Typography>
<h1>Altinn UI components</h1>
<p>
This package is a set of reusable components for building web applications for Altinn 3. It is not a general
purpose library, but a library of components that are specifically designed for the Altinn platform, to ensure
a consistent look and feel across all applications.
This package is a set of reusable components for building web
applications for Altinn 3. It is not a general purpose library, but a
library of components that are specifically designed for the Altinn
platform, to ensure a consistent look and feel across all
applications.
</p>
<p>
<strong>Documentation and demos are work in progress.</strong>
</p>
<h2>About this demo</h2>
<p>
The purpose of this demo is primarily to show how navigating across
multiple areas could work within Altinn, using the same layout and
basic building blocks. Design and content is limited, and might not be
representative of the final product.
</p>
<ul>
<li>
<a href="/?path=/story/demo--inbox&globals=theme:person">
Jump to demo
</a>
</li>
</ul>
<h2>How to use</h2>
<p>xxx</p>
<h1>Layout and RootProvider</h1>
<p>
Use Layout and RootProvider to establish the Altinn interface. Layout provides a global header and footer, as
well as an optional sidebar, while RootProvider takes care of handling global interaction patterns.
Use Layout and RootProvider to establish the Altinn interface. Layout
provides a global header and footer, as well as an optional sidebar,
while RootProvider takes care of handling global interaction patterns.
</p>
<h2>RootProvider</h2>
<p>Handles common interaction tasks like showing/hiding menus, triggering Snackbars, etc.</p>
<p>
Handles common interaction tasks like showing/hiding menus, triggering
Snackbars, etc.
</p>
<ul>
<li>Snackbar</li>
</ul>
<h2>Header</h2>
<p>The header provides ui for search and the global menu, including an account switcher.</p>
<p>
The header provides ui for search and the global menu, including an
account switcher.
</p>
<ul>
<li>Search</li>
<li>Global menu</li>
Expand All @@ -45,7 +76,9 @@ export const Default = () => {
<p>The header provides a simple ui for search and the global menu.</p>

<h1>Theming and colors</h1>
<p>The Altinn color system is built using tokens from Designsystemet.</p>
<p>
The Altinn color system is built using tokens from Designsystemet.
</p>
<h2>Primary colors</h2>
<ul>
<li>Accent: </li>
Expand Down

0 comments on commit 7ba0c1e

Please sign in to comment.