@uob-web-and-digital/component-library 0.0.1 → 0.0.3
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.
- package/README.md +64 -0
- package/dist/components/Button/Button.d.ts +28 -0
- package/dist/components/Button/Button.stories.d.ts +21 -0
- package/dist/components/CampusSelector/CampusSelector.d.ts +15 -0
- package/dist/components/CampusSelector/CampusSelector.stories.d.ts +11 -0
- package/dist/components/CampusSelectorLink/CampusSelectorLink.d.ts +17 -0
- package/dist/components/CampusSelectorLink/CampusSelectorLink.stories.d.ts +11 -0
- package/dist/components/ExampleTheming/ExampleTheming.d.ts +17 -0
- package/dist/components/ExampleTheming/ExampleTheming.stories.d.ts +12 -0
- package/dist/components/Footer/Footer.d.ts +15 -0
- package/dist/components/Footer/Footer.stories.d.ts +13 -0
- package/dist/components/Footer/defaultProps.d.ts +5 -0
- package/dist/components/Header/Header.d.ts +23 -0
- package/dist/components/Header/Header.stories.d.ts +11 -0
- package/dist/components/Header/components/MainMenu.d.ts +10 -0
- package/dist/components/Header/components/NestedMenu.d.ts +11 -0
- package/dist/components/Header/defaultProps.d.ts +2 -0
- package/dist/components/Header/types.d.ts +7 -0
- package/dist/components/IconButton/IconButton.d.ts +18 -0
- package/dist/components/IconButton/IconButton.stories.d.ts +23 -0
- package/dist/components/Icons/Icons.d.ts +18 -0
- package/dist/components/Image/Image.d.ts +13 -0
- package/dist/components/LinkStandard/LinkStandard.d.ts +11 -0
- package/dist/components/LinkStandard/LinkStandard.stories.d.ts +11 -0
- package/dist/components/LinkWithArrow/LinkWithArrow.d.ts +17 -0
- package/dist/components/LinkWithArrow/LinkWithArrow.stories.d.ts +12 -0
- package/dist/components/MainWrapper/MainWrapper.d.ts +5 -0
- package/dist/components/NavLink/NavLink.d.ts +14 -0
- package/dist/components/NavLink/NavLink.stories.d.ts +18 -0
- package/dist/components/PageLink/PageLink.d.ts +17 -0
- package/dist/components/PageLink/PageLink.stories.d.ts +18 -0
- package/dist/components/ReverseLinkWithArrow/ReverseLinkWithArrow.d.ts +19 -0
- package/dist/components/ReverseLinkWithArrow/ReverseLinkWithArrow.stories.d.ts +13 -0
- package/dist/components/SignPost/SignPost.d.ts +29 -0
- package/dist/components/SignPost/SignPost.stories.d.ts +19 -0
- package/dist/components/SignPost/defaultProps.d.ts +2 -0
- package/dist/components/SkipToContent/SkipToContent.d.ts +8 -0
- package/dist/components/SkipToContent/SkipToContent.stories.d.ts +15 -0
- package/dist/components/TextButton/TextButton.d.ts +26 -0
- package/dist/components/TextButton/TextButton.stories.d.ts +14 -0
- package/dist/hooks/useScrollDirection.d.ts +3 -0
- package/dist/index.d.ts +80 -0
- package/dist/main.css +1884 -0
- package/dist/main.js +15671 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +15665 -0
- package/dist/module.js.map +1 -0
- package/dist/themeProps.d.ts +1 -0
- package/dist/util.d.ts +3 -0
- package/package.json +12 -3
package/README.md
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# University of Birmingham Component Library
|
|
2
|
+
This is the frontend component library for the University of Birmingham website built using Storybook 7 and SASS.
|
|
3
|
+
|
|
4
|
+
## Contents
|
|
5
|
+
* [Installation and setup](#installation-and-setup)
|
|
6
|
+
* [Working locally on the project](#working-locally-on-the-project)
|
|
7
|
+
* [Deploying changes to the public Storybook](#deploying-project-changes-to-the-public-storybook)
|
|
8
|
+
* [Publishing changes to the NPMJS package library](#publishing-changes-to-the-npmjs-package-library)
|
|
9
|
+
* [Creating Components](#creating-components)
|
|
10
|
+
|
|
11
|
+
## Installation and setup
|
|
12
|
+
|
|
13
|
+
### Node Compatibility
|
|
14
|
+
**Node:** ^18.18.0
|
|
15
|
+
|
|
16
|
+
### Setting up the project locally
|
|
17
|
+
1. Clone the repo from Github: `git clone git@github.com:uob-itservices/component-library.git`
|
|
18
|
+
2. Install NPM Node Modules by running `npm install` from the project root
|
|
19
|
+
|
|
20
|
+
## Working locally on the project
|
|
21
|
+
Run `npm run storybook` from the project root. This will run a new instance of [Storybook](https://storybook.js.org/) that can be accessed from `localhost:6006`.
|
|
22
|
+
|
|
23
|
+
Changes made locally are automatically compiled and the browser instance of Storybook will automaticaly refresh, hot-loading changes very quickly where possible.
|
|
24
|
+
|
|
25
|
+
## Deploying project changes to the public Storybook
|
|
26
|
+
The visible Storybook for sharing changes is private and is accessed at [https://stunning-invention-1w42em5.pages.github.io/](https://stunning-invention-1w42em5.pages.github.io/) you will need to be a member of the uob-itservices GitHub organisation and have access to the repository.
|
|
27
|
+
|
|
28
|
+
This is automatically deployed and built when changes are pushed to the `develop` branch of the GitHub repository.
|
|
29
|
+
|
|
30
|
+
## Publishing changes to the NPMJS package library
|
|
31
|
+
The repository will need publishing to the NPMJS package library [https://www.npmjs.com/package/@uob-web-and-digital/component-library](https://www.npmjs.com/package/@uob-web-and-digital/component-library) before it can be used in the UoB website.
|
|
32
|
+
|
|
33
|
+
This is a private package so a read-only NPM access token will need be created in order to install the package.
|
|
34
|
+
|
|
35
|
+
When the library in ready for a new release of the NPM package, you will need to increase the version number in the package.json and run a `npm install` to ensure the project gets updated with this version. After this you will need to create a pull request into the `develop`` branch and then another pull request from the `develop`` branch into `main`
|
|
36
|
+
|
|
37
|
+
As this is a manual process, ensure that the `main` branch of the repository is always in sync with the currently published package.
|
|
38
|
+
|
|
39
|
+
Releasing to the NPM registry are managed by GitHub Actions. You will need to create a new release and use the new release version as the tag. Once the release is published a GitHub Action will automatically run all the steps to publish the package on NPM.
|
|
40
|
+
|
|
41
|
+
## Creating components
|
|
42
|
+
Components should always be created within the `src/components` folder.
|
|
43
|
+
|
|
44
|
+
### Naming component folders
|
|
45
|
+
You can create a new folder within `src/components` that is based on the chosen name for your component. The format of this folder name, react component and story should always be PascalCase i.e. `MyNewComponent`. SASS files should always be camelCase i.e. `myNewComponent`
|
|
46
|
+
|
|
47
|
+
### Component file structure
|
|
48
|
+
Within the component folder you must create the following 3 files:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
ComponentName
|
|
52
|
+
|_ {ComponentName}.tsx
|
|
53
|
+
|_ {ComponentName}.stories.ts
|
|
54
|
+
|_ {componentName}.scss
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### {ComponentName}.tsx
|
|
58
|
+
This file is where the Component Structure is defined.
|
|
59
|
+
|
|
60
|
+
#### {ComponentName}.stories.ts
|
|
61
|
+
This file allows developers to pass in mockup content to the component that will render within Storybook. More information is available in the Storybook docs [Storybook JS - Defining Stories](https://storybook.js.org/docs/react/writing-stories/introduction#defining-stories)
|
|
62
|
+
|
|
63
|
+
#### componentName.scss
|
|
64
|
+
This is where component styling is defined using SASS/CSS.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import './button.scss';
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Is this the principal call to action on the page?
|
|
6
|
+
*/
|
|
7
|
+
primary?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* What background color to use
|
|
10
|
+
*/
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
/**
|
|
13
|
+
* How large should the button be?
|
|
14
|
+
*/
|
|
15
|
+
size?: 'small' | 'medium' | 'large';
|
|
16
|
+
/**
|
|
17
|
+
* Button contents
|
|
18
|
+
*/
|
|
19
|
+
label: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional click handler
|
|
22
|
+
*/
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Primary UI component for user interaction
|
|
27
|
+
*/
|
|
28
|
+
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => ReactElement;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
argTypes: {
|
|
11
|
+
backgroundColor: {
|
|
12
|
+
control: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
export declare const Primary: Story;
|
|
19
|
+
export declare const Secondary: Story;
|
|
20
|
+
export declare const Large: Story;
|
|
21
|
+
export declare const Small: Story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './campusSelector.scss';
|
|
4
|
+
interface CampusSelectorProps {
|
|
5
|
+
/**
|
|
6
|
+
* The theme to use
|
|
7
|
+
*/
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
active: 'uk' | 'dubai';
|
|
10
|
+
ukUrl: string;
|
|
11
|
+
dubaiUrl: string;
|
|
12
|
+
mobile: boolean;
|
|
13
|
+
}
|
|
14
|
+
export default function CampusSelector({ active, theme, ukUrl, dubaiUrl, mobile }: CampusSelectorProps): ReactElement;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import CampusSelector from './CampusSelector';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof CampusSelector;
|
|
6
|
+
tags: string[];
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof CampusSelector>;
|
|
10
|
+
export declare const Mobile: Story;
|
|
11
|
+
export declare const Desktop: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './campusSelectorLink.scss';
|
|
4
|
+
export interface CampusSelectorLinkProps {
|
|
5
|
+
/**
|
|
6
|
+
* The theme to use
|
|
7
|
+
*/
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to inverse the colours
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
url: string;
|
|
14
|
+
externalLink?: boolean;
|
|
15
|
+
active?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export default function CampusSelectorLink({ theme, label, url, externalLink, active }: CampusSelectorLinkProps): ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import CampusSelectorLink from './CampusSelectorLink';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof CampusSelectorLink;
|
|
6
|
+
tags: string[];
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof CampusSelectorLink>;
|
|
10
|
+
export declare const Default: Story;
|
|
11
|
+
export declare const Active: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './exampleTheming.scss';
|
|
4
|
+
export interface ExampleThemingProps {
|
|
5
|
+
/**
|
|
6
|
+
* The theme to use
|
|
7
|
+
*/
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to inverse the colours
|
|
11
|
+
*/
|
|
12
|
+
inverse?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Primary UI component for user interaction
|
|
16
|
+
*/
|
|
17
|
+
export declare const ExampleTheming: ({ theme, inverse }: ExampleThemingProps) => ReactElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
import { ExampleTheming } from './ExampleTheming';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: ({ theme, inverse }: import("./ExampleTheming").ExampleThemingProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
tags: string[];
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof ExampleTheming>;
|
|
11
|
+
export declare const Dark: Story;
|
|
12
|
+
export declare const Light: Story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './footer.scss';
|
|
4
|
+
export interface FooterLinkProps {
|
|
5
|
+
label: string;
|
|
6
|
+
href: string;
|
|
7
|
+
externalLink: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface FooterProps {
|
|
10
|
+
theme: ThemeProps;
|
|
11
|
+
summaryLinks: FooterLinkProps[];
|
|
12
|
+
hygieneLinks: FooterLinkProps[];
|
|
13
|
+
locations: FooterLinkProps[];
|
|
14
|
+
}
|
|
15
|
+
export default function Footer({ theme, locations, summaryLinks, hygieneLinks }: FooterProps): ReactElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import Footer from './Footer';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof Footer;
|
|
6
|
+
tags: string[];
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const FooterExample: Story;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FooterProps, FooterLinkProps } from './Footer';
|
|
2
|
+
export declare const footerSummaryLinks: FooterLinkProps[];
|
|
3
|
+
export declare const footerHygieneLinks: FooterLinkProps[];
|
|
4
|
+
export declare const footerLocations: FooterLinkProps[];
|
|
5
|
+
export declare const footerProps: FooterProps;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import { HeaderLink } from './types';
|
|
4
|
+
import './header.scss';
|
|
5
|
+
export interface HeaderProps {
|
|
6
|
+
/**
|
|
7
|
+
* The theme to use
|
|
8
|
+
*/
|
|
9
|
+
theme: ThemeProps;
|
|
10
|
+
/**
|
|
11
|
+
* Large nav links on the main menu
|
|
12
|
+
*/
|
|
13
|
+
primaryLinks: HeaderLink[];
|
|
14
|
+
/**
|
|
15
|
+
* Small nav links on the main menu
|
|
16
|
+
*/
|
|
17
|
+
secondaryLinks: HeaderLink[];
|
|
18
|
+
homepageUrl: string;
|
|
19
|
+
dubaiUrl: string;
|
|
20
|
+
ukUrl: string;
|
|
21
|
+
activeCampus: 'uk' | 'dubai';
|
|
22
|
+
}
|
|
23
|
+
export declare const Header: ({ theme, primaryLinks, secondaryLinks, homepageUrl, dubaiUrl, ukUrl, activeCampus }: HeaderProps) => ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
import { Header } from './Header';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: ({ theme, primaryLinks, secondaryLinks, homepageUrl, dubaiUrl, ukUrl, activeCampus }: import("./Header").HeaderProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
tags: string[];
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Header>;
|
|
11
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { HeaderLink } from '../types';
|
|
3
|
+
import { ThemeProps } from '../../../themeProps';
|
|
4
|
+
export interface MainMenuProps {
|
|
5
|
+
primaryLinks: HeaderLink[];
|
|
6
|
+
secondaryLinks: HeaderLink[];
|
|
7
|
+
onClickNavLink: (idx: number) => void;
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
}
|
|
10
|
+
export declare const MainMenu: ({ primaryLinks, secondaryLinks, onClickNavLink, theme }: MainMenuProps) => ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { HeaderLink } from '../types';
|
|
3
|
+
import { ThemeProps } from '../../../themeProps';
|
|
4
|
+
export interface NestedMenuProps {
|
|
5
|
+
headingLink: HeaderLink;
|
|
6
|
+
onClickGoBack: () => void;
|
|
7
|
+
onClickNavLink: (idx: number) => void;
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
backLinkLabel: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const NestedMenu: ({ headingLink, onClickGoBack, onClickNavLink, theme, backLinkLabel }: NestedMenuProps) => ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconType } from '../Icons/Icons';
|
|
3
|
+
import { ThemeProps } from '../../themeProps';
|
|
4
|
+
import './icon-button.scss';
|
|
5
|
+
export interface IconButtonProps {
|
|
6
|
+
theme: ThemeProps;
|
|
7
|
+
inverse?: boolean;
|
|
8
|
+
url?: string;
|
|
9
|
+
title: string;
|
|
10
|
+
icon: IconType;
|
|
11
|
+
externalLink?: boolean;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
ariaControls?: string;
|
|
14
|
+
autoFocus?: boolean;
|
|
15
|
+
}
|
|
16
|
+
type Ref = HTMLButtonElement | null;
|
|
17
|
+
export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<Ref>>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: import("react").ForwardRefExoticComponent<import("./IconButton").IconButtonProps & import("react").RefAttributes<HTMLButtonElement | null>>;
|
|
6
|
+
tags: string[];
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof meta>;
|
|
10
|
+
export declare const FacebookDark: Story;
|
|
11
|
+
export declare const FacebookLight: Story;
|
|
12
|
+
export declare const TwitterDark: Story;
|
|
13
|
+
export declare const TwitterLight: Story;
|
|
14
|
+
export declare const InstagramDark: Story;
|
|
15
|
+
export declare const InstagramLight: Story;
|
|
16
|
+
export declare const WeiboDark: Story;
|
|
17
|
+
export declare const WeiboLight: Story;
|
|
18
|
+
export declare const WechatDark: Story;
|
|
19
|
+
export declare const WechatLight: Story;
|
|
20
|
+
export declare const YoutubeDark: Story;
|
|
21
|
+
export declare const YoutubeLight: Story;
|
|
22
|
+
export declare const HamburgerDark: Story;
|
|
23
|
+
export declare const HamburgerLight: Story;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './icons.scss';
|
|
4
|
+
export type IconType = 'twitter' | 'facebook' | 'wechat' | 'weibo' | 'youtube' | 'instagram' | 'linkedin' | 'chevron-down' | 'chevron-right' | 'arrow-right' | 'arrow-right-large' | 'location' | 'hamburger' | 'cross' | 'arrow-left';
|
|
5
|
+
export type IconProps = {
|
|
6
|
+
/**
|
|
7
|
+
* The theme to use
|
|
8
|
+
*/
|
|
9
|
+
theme: ThemeProps;
|
|
10
|
+
/**
|
|
11
|
+
* Whether to inverse the colours
|
|
12
|
+
*/
|
|
13
|
+
inverse?: boolean;
|
|
14
|
+
icon: IconType;
|
|
15
|
+
name?: string;
|
|
16
|
+
ariaHidden?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export default function Icon({ icon, ariaHidden, theme, inverse }: IconProps): ReactElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import './image.scss';
|
|
3
|
+
export type ImageProps = {
|
|
4
|
+
src: {
|
|
5
|
+
small?: string;
|
|
6
|
+
medium?: string;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
altText?: string | null;
|
|
10
|
+
title?: string | null;
|
|
11
|
+
loadingAttr?: 'lazy' | 'eager' | undefined;
|
|
12
|
+
};
|
|
13
|
+
export default function Image({ src, altText, title, loadingAttr }: ImageProps): ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './link-standard.scss';
|
|
4
|
+
export interface LinkStandardProps {
|
|
5
|
+
theme: ThemeProps;
|
|
6
|
+
inverse?: boolean;
|
|
7
|
+
url: string;
|
|
8
|
+
title: string;
|
|
9
|
+
externalLink: boolean;
|
|
10
|
+
}
|
|
11
|
+
export default function LinkStandard({ theme, inverse, url, title, externalLink }: LinkStandardProps): ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import LinkStandard from './LinkStandard';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof LinkStandard;
|
|
6
|
+
tags: string[];
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof meta>;
|
|
10
|
+
export declare const Dark: Story;
|
|
11
|
+
export declare const Light: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './link-with-arrow.scss';
|
|
4
|
+
export interface LinkWithArrowProps {
|
|
5
|
+
/**
|
|
6
|
+
* The theme to use
|
|
7
|
+
*/
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to inverse the colours
|
|
11
|
+
*/
|
|
12
|
+
inverse?: boolean;
|
|
13
|
+
url: string;
|
|
14
|
+
title: string;
|
|
15
|
+
externalLink?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export default function LinkWithArrow({ theme, inverse, url, title, externalLink }: LinkWithArrowProps): ReactElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import LinkWithArrow from './LinkWithArrow';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof LinkWithArrow;
|
|
6
|
+
tags: string[];
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof LinkWithArrow>;
|
|
10
|
+
export declare const Dark: Story;
|
|
11
|
+
export declare const Light: Story;
|
|
12
|
+
export declare const Long: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './NavLink.scss';
|
|
4
|
+
export interface NavLinkProps {
|
|
5
|
+
/**
|
|
6
|
+
* The theme to use
|
|
7
|
+
*/
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
label: string;
|
|
10
|
+
level: 'level-one' | 'level-two';
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
autoFocus?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const NavLink: ({ theme, onClick, label, level, autoFocus }: NavLinkProps) => ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
import { NavLink } from './NavLink';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: ({ theme, onClick, label, level, autoFocus }: import("./NavLink").NavLinkProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
7
|
+
tags: string[];
|
|
8
|
+
parameters: {
|
|
9
|
+
backgrounds: {
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof NavLink>;
|
|
16
|
+
export declare const LevelOne: Story;
|
|
17
|
+
export declare const LevelTwo: Story;
|
|
18
|
+
export declare const Long: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './PageLink.scss';
|
|
4
|
+
export interface PageLinkProps {
|
|
5
|
+
/**
|
|
6
|
+
* The theme to use
|
|
7
|
+
*/
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
url: string;
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* The level in the navigation menu
|
|
13
|
+
*/
|
|
14
|
+
level: 'level-one' | 'level-two';
|
|
15
|
+
autoFocus?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const PageLink: ({ theme, url, label, level, autoFocus }: PageLinkProps) => ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
import { PageLink } from './PageLink';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: ({ theme, url, label, level, autoFocus }: import("./PageLink").PageLinkProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
7
|
+
tags: string[];
|
|
8
|
+
parameters: {
|
|
9
|
+
backgrounds: {
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof PageLink>;
|
|
16
|
+
export declare const LevelOne: Story;
|
|
17
|
+
export declare const LevelTwo: Story;
|
|
18
|
+
export declare const Long: Story;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './ReverseLinkWithArrow.scss';
|
|
4
|
+
export interface ReverseLinkWithArrowProps {
|
|
5
|
+
/**
|
|
6
|
+
* The theme to use
|
|
7
|
+
*/
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to inverse the colours
|
|
11
|
+
*/
|
|
12
|
+
inverse?: boolean;
|
|
13
|
+
label: string;
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Same as LinkWithArrow but arrow is on the left side
|
|
18
|
+
*/
|
|
19
|
+
export declare const ReverseLinkWithArrow: ({ theme, inverse, label, onClick }: ReverseLinkWithArrowProps) => ReactElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
import { ReverseLinkWithArrow } from './ReverseLinkWithArrow';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: ({ theme, inverse, label, onClick }: import("./ReverseLinkWithArrow").ReverseLinkWithArrowProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
7
|
+
tags: string[];
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof ReverseLinkWithArrow>;
|
|
11
|
+
export declare const Dark: Story;
|
|
12
|
+
export declare const Light: Story;
|
|
13
|
+
export declare const Long: Story;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ThemeProps } from '../../themeProps';
|
|
3
|
+
import './SignPost.scss';
|
|
4
|
+
export interface SignPostProps {
|
|
5
|
+
/**
|
|
6
|
+
* The theme to use
|
|
7
|
+
*/
|
|
8
|
+
theme: ThemeProps;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to inverse the colours
|
|
11
|
+
*/
|
|
12
|
+
inverse?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* A SignPost can have 2 or 4 items
|
|
15
|
+
*/
|
|
16
|
+
items: readonly [SignPostItem, SignPostItem];
|
|
17
|
+
}
|
|
18
|
+
type SignPostItem = {
|
|
19
|
+
title: string;
|
|
20
|
+
tag: string;
|
|
21
|
+
linkLabel: string;
|
|
22
|
+
linkUrl: string;
|
|
23
|
+
external?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Text promo block with a link
|
|
27
|
+
*/
|
|
28
|
+
export default function SignPost({ theme, inverse, items }: SignPostProps): ReactElement;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
import SignPost from './SignPost';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: typeof SignPost;
|
|
7
|
+
tags: string[];
|
|
8
|
+
parameters: {
|
|
9
|
+
backgrounds: {
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof SignPost>;
|
|
16
|
+
export declare const Dark: Story;
|
|
17
|
+
export declare const Light: Story;
|
|
18
|
+
export declare const Stacked: () => ReactElement;
|
|
19
|
+
export declare const Long: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import './SkipToContent.scss';
|
|
3
|
+
import { ThemeProps } from '../../themeProps';
|
|
4
|
+
interface SkipToContentProps {
|
|
5
|
+
theme: ThemeProps;
|
|
6
|
+
}
|
|
7
|
+
export default function SkipToContent({ theme }: SkipToContentProps): ReactElement;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import SkipToContent from './SkipToContent';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof SkipToContent;
|
|
6
|
+
tags: string[];
|
|
7
|
+
parameters: {
|
|
8
|
+
backgrounds: {
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof SkipToContent>;
|
|
15
|
+
export declare const Default: Story;
|