@nationalarchives/frontend 0.1.23-prerelease → 0.1.24-prerelease
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/govuk-prototype-kit.config.json +1 -1
- package/nationalarchives/all.css +2 -2
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/assets/fonts/OpenSans-Regular.ttf +0 -0
- package/nationalarchives/assets/fonts/RobotoMono-Medium.ttf +0 -0
- package/nationalarchives/components/_index.scss +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
- package/nationalarchives/components/button/button.css +1 -1
- package/nationalarchives/components/button/button.css.map +1 -1
- package/nationalarchives/components/button/button.scss +4 -4
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/card/card.scss +3 -2
- package/nationalarchives/components/card/card.stories.js +21 -0
- package/nationalarchives/components/card/macro-options.json +6 -0
- package/nationalarchives/components/card/template.njk +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.css +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.scss +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +3 -3
- package/nationalarchives/components/cookie-banner/fixtures.json +57 -1
- package/nationalarchives/components/cookie-banner/template.njk +3 -3
- package/nationalarchives/components/featured-records/_index.scss +1 -0
- package/nationalarchives/components/featured-records/featured-records.css +1 -0
- package/nationalarchives/components/featured-records/featured-records.css.map +1 -0
- package/nationalarchives/components/featured-records/featured-records.scss +95 -0
- package/nationalarchives/components/featured-records/featured-records.stories.js +51 -0
- package/nationalarchives/components/featured-records/fixtures.json +4 -0
- package/nationalarchives/components/featured-records/macro-options.json +70 -0
- package/nationalarchives/components/featured-records/macro.njk +3 -0
- package/nationalarchives/components/featured-records/template.njk +20 -0
- package/nationalarchives/components/filters/filters.css +1 -1
- package/nationalarchives/components/filters/filters.css.map +1 -1
- package/nationalarchives/components/footer/footer.css +1 -1
- package/nationalarchives/components/footer/footer.css.map +1 -1
- package/nationalarchives/components/footer/footer.scss +2 -5
- package/nationalarchives/components/footer/template.njk +1 -1
- package/nationalarchives/components/gallery/gallery.css +1 -1
- package/nationalarchives/components/gallery/gallery.css.map +1 -1
- package/nationalarchives/components/gallery/gallery.scss +2 -2
- package/nationalarchives/components/grid/grid.css +1 -1
- package/nationalarchives/components/grid/grid.css.map +1 -1
- package/nationalarchives/components/header/header.css +1 -1
- package/nationalarchives/components/header/header.css.map +1 -1
- package/nationalarchives/components/header/header.scss +46 -8
- package/nationalarchives/components/header/header.stories.js +4 -6
- package/nationalarchives/components/header/macro-options.json +2 -2
- package/nationalarchives/components/header/template.njk +2 -2
- package/nationalarchives/components/hero/hero.css +1 -1
- package/nationalarchives/components/hero/hero.css.map +1 -1
- package/nationalarchives/components/hero/hero.scss +4 -4
- package/nationalarchives/components/index-grid/index-grid.css +1 -1
- package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
- package/nationalarchives/components/index-grid/index-grid.scss +1 -1
- package/nationalarchives/components/message/message.css +1 -1
- package/nationalarchives/components/message/message.css.map +1 -1
- package/nationalarchives/components/pagination/pagination.css +1 -1
- package/nationalarchives/components/pagination/pagination.css.map +1 -1
- package/nationalarchives/components/pagination/pagination.scss +1 -1
- package/nationalarchives/components/pagination/pagination.stories.js +354 -0
- package/nationalarchives/components/pagination/template.njk +1 -1
- package/nationalarchives/components/phase-banner/fixtures.json +5 -41
- package/nationalarchives/components/phase-banner/macro-options.json +6 -0
- package/nationalarchives/components/phase-banner/phase-banner.css +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.scss +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.stories.js +4 -28
- package/nationalarchives/components/phase-banner/template.njk +3 -1
- package/nationalarchives/components/picture/picture.css +1 -1
- package/nationalarchives/components/picture/picture.css.map +1 -1
- package/nationalarchives/components/picture/picture.scss +5 -4
- package/nationalarchives/components/sensitive-image/sensitive-image.css +1 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.css.map +1 -1
- package/nationalarchives/components/skip-link/skip-link.css +1 -1
- package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
- package/nationalarchives/components/tabs/tabs.css +1 -1
- package/nationalarchives/components/tabs/tabs.css.map +1 -1
- package/nationalarchives/components/tabs/tabs.js +1 -1
- package/nationalarchives/components/tabs/tabs.js.map +1 -1
- package/nationalarchives/components/tabs/tabs.mjs +0 -4
- package/nationalarchives/prototype-kit.css +23 -0
- package/nationalarchives/prototype-kit.css.map +1 -0
- package/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js +38 -11
- package/nationalarchives/stories/utilities/lists/lists.mdx +18 -0
- package/nationalarchives/stories/utilities/{typography → lists}/lists.stories.js +1 -1
- package/nationalarchives/stories/utilities/overrides/overrides.mdx +27 -20
- package/nationalarchives/stories/utilities/overrides/overrides.stories.js +18 -2
- package/nationalarchives/stories/utilities/typography/typography.mdx +3 -25
- package/nationalarchives/stories/utilities/typography/typography.stories.js +28 -2
- package/nationalarchives/templates/layouts/_generic.njk +1 -0
- package/nationalarchives/templates/layouts/_prototype-kit.njk +2 -1
- package/nationalarchives/tools/_colour.scss +13 -20
- package/nationalarchives/tools/_spacing.scss +91 -2
- package/nationalarchives/tools/_typography.scss +15 -8
- package/nationalarchives/utilities/_a11y.scss +2 -1
- package/nationalarchives/utilities/_colour.scss +100 -0
- package/nationalarchives/utilities/_global.scss +2 -98
- package/nationalarchives/utilities/_index.scss +1 -0
- package/nationalarchives/utilities/_overrides.scss +16 -36
- package/nationalarchives/utilities/_typography.scss +145 -51
- package/nationalarchives/variables/_colour.scss +9 -8
- package/nationalarchives/variables/_spacing.scss +14 -9
- package/nationalarchives/variables/_typography.scss +10 -7
- package/package.json +9 -9
- package/nationalarchives/assets/fonts/OpenSans-Medium.ttf +0 -0
- package/nationalarchives/assets/fonts/fa-regular-400.ttf +0 -0
- package/nationalarchives/assets/fonts/fa-regular-400.woff2 +0 -0
- package/nationalarchives/components/profile/_index.scss +0 -1
- package/nationalarchives/components/profile/fixtures.json +0 -4
- package/nationalarchives/components/profile/macro-options.json +0 -14
- package/nationalarchives/components/profile/macro.njk +0 -3
- package/nationalarchives/components/profile/profile.css +0 -1
- package/nationalarchives/components/profile/profile.css.map +0 -1
- package/nationalarchives/components/profile/profile.scss +0 -5
- package/nationalarchives/components/profile/profile.stories.js +0 -31
- package/nationalarchives/components/profile/template.njk +0 -15
- package/nationalarchives/lib/font-awesome/regular.css +0 -5
- package/nationalarchives/lib/font-awesome/regular.css.map +0 -1
- package/nationalarchives/lib/font-awesome/regular.scss +0 -28
- package/nationalarchives/stories/development/about.mdx +0 -122
- package/nationalarchives/stories/development/contributing.mdx +0 -32
- package/nationalarchives/stories/development/cookies.mdx +0 -82
- package/nationalarchives/stories/development/publishing.mdx +0 -15
- package/nationalarchives/stories/development/structure.mdx +0 -88
- package/nationalarchives/stories/development/using/compiled.mdx +0 -9
- package/nationalarchives/stories/development/using/hosted.mdx +0 -53
- package/nationalarchives/stories/development/using/npm.mdx +0 -59
- /package/nationalarchives/{_prototype-kit.scss → prototype-kit.scss} +0 -0
@@ -1,32 +0,0 @@
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
2
|
-
|
3
|
-
<Meta title="Development/Contributing" />
|
4
|
-
|
5
|
-
# Contributing to the frontend styles
|
6
|
-
|
7
|
-
## Adding a new component
|
8
|
-
|
9
|
-
1. Create a new directory in `src/nationalarchives/components`
|
10
|
-
1. Create an `_index.scss`, `[myComponent].scss`, `fixtures.json`, `macro-options.json`, `macro.njk`, `template.njk` and a `[myComponent].stories.js` in the directory using other components as a guide
|
11
|
-
1. Add the component SCSS to `src/nationalarchives/components/_all.scss`
|
12
|
-
1. Update `tasks/test-package.js` to check for the files as part of the CI - `...componentFiles("myComponent")`
|
13
|
-
1. Set the macro in `macro.njk` to be `tnaMyComponent` where "MyComponent" is the name of your component
|
14
|
-
1. Add the component import and macro to the prototype kit test in `.github/workflows/ci.yml`
|
15
|
-
|
16
|
-
### Files
|
17
|
-
|
18
|
-
- `_index.scss` - Simply includes `@use "myComponent";` so we can include this directory within SASS and have it reference the styles in `[myComponent].scss`
|
19
|
-
- `[myComponent].scss` - this file gets built as a standalone file as well as being included in all styles and is where you can add your [BEM](https://getbem.com/) SCSS styles for the component
|
20
|
-
- `fixtures.json` - these are snapshots of the rendered component's HTML in different scenarios which can be used by other implementations to test against
|
21
|
-
- `macro-options.json` - the options for the component which are rendered in the Design System as well as being copied in to the Storybook controls
|
22
|
-
- `macro.njk` - the Nunjucks macro easily allows us to include components in the prototype kit and other applications such as the Design System
|
23
|
-
- `template.njk` - this is the HTML for the component, written in [Nunjucks](https://mozilla.github.io/nunjucks/)
|
24
|
-
- `[myComponent].stories.js` - the stories that get rendered to Storybook
|
25
|
-
|
26
|
-
### If you need JavaScript
|
27
|
-
|
28
|
-
1. Create a `[myComponent].mjs` file in the component directory
|
29
|
-
1. Ensure the top level element in your component has the attribute `data-module="tna-my-component"`
|
30
|
-
1. Import and initialise your component as part of the `initAll` function in `src/nationalarchives/all.mjs`
|
31
|
-
1. Update the check in `tasks/test-package.js` to add the JavaScript class to check for
|
32
|
-
1. If your component uses JavaScript, ensure you add interaction tests using `@storybook/testing-library`
|
@@ -1,82 +0,0 @@
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
2
|
-
import { Mermaid } from 'mdx-mermaid/Mermaid';
|
3
|
-
|
4
|
-
<Meta title="Development/Cookies" />
|
5
|
-
|
6
|
-
# Cookies handling
|
7
|
-
|
8
|
-
The principles of cookie handling are:
|
9
|
-
|
10
|
-
- Create cookies on the client side (apart from session cookies)
|
11
|
-
- Update cookies on the client side (apart from session cookies)
|
12
|
-
- Reject by default (don't assume acceptance and don't add tracking until after they agree)
|
13
|
-
|
14
|
-
## Policies
|
15
|
-
|
16
|
-
As standard we should use at least these three classes of cookies:
|
17
|
-
|
18
|
-
- `essential` - we don't need to ask permission for these
|
19
|
-
- `usage` - analytics, tracking, data gathering
|
20
|
-
- `settings` - configured options for the site (e.g. default results view or static light/dark mode)
|
21
|
-
|
22
|
-
## Process
|
23
|
-
|
24
|
-
### First visit
|
25
|
-
|
26
|
-
<Mermaid chart={`sequenceDiagram
|
27
|
-
User->>Browser: Request page
|
28
|
-
Browser->>Server: HTTP request with no cookies
|
29
|
-
Server->>Browser: Rendered HTML with cookie banner and no analytics
|
30
|
-
Browser->>User: Accept cookies?
|
31
|
-
alt Accept
|
32
|
-
User->>Browser: Accept cookies
|
33
|
-
Browser->>Browser: Create cookie policy with all accepted
|
34
|
-
Browser->>Browser: Add analytics code with JavaScript
|
35
|
-
else Reject
|
36
|
-
User->>Browser: Reject cookies
|
37
|
-
Browser->>Browser: Create cookie policy with all rejected
|
38
|
-
end
|
39
|
-
opt Next request
|
40
|
-
User->>Browser: Request page
|
41
|
-
Browser->>Server: HTTP request with cookie policy
|
42
|
-
Server->>Browser: Rendered HTML with analytics but no cookie banner
|
43
|
-
end
|
44
|
-
`} />
|
45
|
-
|
46
|
-
### Repeat visit
|
47
|
-
|
48
|
-
<Mermaid chart={`sequenceDiagram
|
49
|
-
User->>Browser: Request page
|
50
|
-
Browser->>Server: HTTP request with cookie policy
|
51
|
-
Server->>Browser: Rendered HTML with analytics but no cookie banner
|
52
|
-
`} />
|
53
|
-
|
54
|
-
## Cookie library
|
55
|
-
|
56
|
-
When you load in the tna-frontend JavaScript, it comes with a [cookie library](https://github.com/nationalarchives/tna-frontend/blob/main/src/nationalarchives/lib/cookies.mjs).
|
57
|
-
|
58
|
-
This is loaded into the `window` object as `TNAFrontend.Cookies`:
|
59
|
-
|
60
|
-
```JavaScript
|
61
|
-
// Initialise a new Cookie instance
|
62
|
-
const cookies = new TNAFrontend.Cookies();
|
63
|
-
|
64
|
-
// Log all the cookies to the console
|
65
|
-
console.log(cookies.all);
|
66
|
-
```
|
67
|
-
|
68
|
-
### Functions
|
69
|
-
|
70
|
-
- `cookies.all` - Returns all the cookies
|
71
|
-
- `cookies.exists(key)` - Returns `true` if a cookie exists with the name `key`
|
72
|
-
- `cookies.hasValue(key, value)` - Returns `true` if the cookie with the name `key` is equal to `value`
|
73
|
-
- `cookies.get(key)` - Returns the cookie with the name `key`
|
74
|
-
- `cookies.set(key, value, maxAge, path)` - Set a cookie (max age default is one year, default path is `/`)
|
75
|
-
- `cookies.delete(key)` - Deletes the cookie with the name `key`
|
76
|
-
- `cookies.allPolicies` - Returns all the cookie policies
|
77
|
-
- `cookies.acceptPolicy(policy)` - Accepts the policy with the name `policy`
|
78
|
-
- `cookies.rejectPolicy(policy)` - Rejects the policy with the name `policy`
|
79
|
-
- `cookies.setPolicy(policy, accepted)` - Accepts or rejects the policy with the name `policy` depending on the value of `accepted`
|
80
|
-
- `cookies.acceptAllPolicies()` - Accepts all policies
|
81
|
-
- `cookies.rejectAllPolicies()` - Rejects all policies
|
82
|
-
- `cookies.isPolicyAccepted(policy)` - Returns `true` or `false` depending on whether the policy has been accepted
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
2
|
-
|
3
|
-
<Meta title="Development/Publishing" />
|
4
|
-
|
5
|
-
# Publishing a new version
|
6
|
-
|
7
|
-
1. Update `version` in `package.json` using [SemVer](https://semver.org/)
|
8
|
-
1. Update the CHANGELOG
|
9
|
-
1. Run `nvm use` to ensure the correct Node version is used
|
10
|
-
1. Run `npm install` to update the `package-lock.json`
|
11
|
-
1. Merge all changes to `main` via a pull request
|
12
|
-
1. Wait for the CI to pass
|
13
|
-
1. Create a [new release on GitHub](https://github.com/nationalarchives/tna-frontend/releases/new) and add a new tag in the format `v1.0.0` (ensure leading `v` and change version number as necessary)
|
14
|
-
|
15
|
-
Once a release is created, the [publish pipeline](https://github.com/nationalarchives/tna-frontend/blob/main/.github/workflows/npm-publish.yml) will be triggered.
|
@@ -1,88 +0,0 @@
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
2
|
-
|
3
|
-
<Meta title="Development/Structure" />
|
4
|
-
|
5
|
-
# Structure
|
6
|
-
|
7
|
-
The layers of the TNA frontend SCSS library is built as:
|
8
|
-
|
9
|
-
1. [Variables](#variables)
|
10
|
-
1. [Tools](#tools)
|
11
|
-
1. [Libraries](#libraries)/[Utilities](#utilities)
|
12
|
-
1. [Components](#components)
|
13
|
-
1. [Overrides](#overrides)
|
14
|
-
|
15
|
-
## Variables
|
16
|
-
|
17
|
-
TNA frontend variables are defined in `src/nationalarchives/variables`.
|
18
|
-
|
19
|
-
Lots of variables can be modified but some are fixed, such as our brand colours.
|
20
|
-
|
21
|
-
An example fixed variable is `$relative-1rem-px` where we set the value of `1rem` to `16px` which makes it easier to define widths as a function of `1rem` as we mostly work on a 4px grid:
|
22
|
-
|
23
|
-
| Pixels | REM |
|
24
|
-
| ------ | ----------- |
|
25
|
-
| `1px` | `0.0625rem` |
|
26
|
-
| `2px` | `0.125rem` |
|
27
|
-
| `4px` | `0.25rem` |
|
28
|
-
| `8px` | `0.5rem` |
|
29
|
-
| `16px` | `1rem` |
|
30
|
-
| `32px` | `2rem` |
|
31
|
-
| `64px` | `4rem` |
|
32
|
-
|
33
|
-
An example of a variable that can be modified is `$body-font-size-px` which we set to `18px` by default. This font size might not be right for all services so we have allowed it to be modified.
|
34
|
-
|
35
|
-
## Tools
|
36
|
-
|
37
|
-
The tools provided are reusable `@mixin` and `@function` blocks to make writing styles easier. They are defined in `src/nationalarchives/tools`.
|
38
|
-
|
39
|
-
Tools rely directly on variables and can be used throughout the frontend library.
|
40
|
-
|
41
|
-
As an exmaple, `colour-font()` will apply a font colour in a way that should work for all browsers and takes into consideration the light/dark theme used.
|
42
|
-
|
43
|
-
## Libraries
|
44
|
-
|
45
|
-
The libraries in `src/nationalarchives/lib` are a mix of third party libraries as well as some TNA ones.
|
46
|
-
|
47
|
-
They can join up tools to make larger, more useful elements.
|
48
|
-
|
49
|
-
## Utilities
|
50
|
-
|
51
|
-
The utilities in `src/nationalarchives/utilities` are some global styles that aren't associated with a specific component.
|
52
|
-
|
53
|
-
This layer is where we define some general purpose elements such as:
|
54
|
-
|
55
|
-
- The `tna-template` and `tna-template__body` elements
|
56
|
-
- Headings
|
57
|
-
- Lists
|
58
|
-
- Chips
|
59
|
-
- `<p>` elements
|
60
|
-
- General media elements like `<img>`, `<svg>`, `<picture>`, `<video>` and `<canvas>`
|
61
|
-
- Columns
|
62
|
-
- General form elements
|
63
|
-
|
64
|
-
These elements all still adhere to the [BEM methodology](https://getbem.com/).
|
65
|
-
|
66
|
-
Utilities should not implement any `!important` rules.
|
67
|
-
|
68
|
-
## Components
|
69
|
-
|
70
|
-
The most prominent layer of styling, the components in `src/nationalarchives/components` should use the tools already defined.
|
71
|
-
|
72
|
-
Components shouldn't use variables directly. They shouldn't use static values for colour unless the colour of that component will never change, for example the message component which is always yellow.
|
73
|
-
|
74
|
-
Some components may use utilities such as headings. Where these styles have already been defined, they should not be redefined. The heading in a cookie banner should use the existing `tna-heading` and `tna-heading--m` styles that already exist rather than implimenting its own.
|
75
|
-
|
76
|
-
Components should not implement any `!important` rules. There are exceptions such as the skip link that needs to be visually hidden in a way that it is still available for someone navigating a site with a keyboard.
|
77
|
-
|
78
|
-
Components should not care about the context or layout within which they are used. As an example, a breadcrumb *could* be placed within a card or a footer element although in reality we wouldn't allow this.
|
79
|
-
|
80
|
-
## Overrides
|
81
|
-
|
82
|
-
Overrides start with `tna-!--` and can only be used in HTML classes. They have `!important` rules.
|
83
|
-
|
84
|
-
Examples of overrides are:
|
85
|
-
|
86
|
-
- Spacing (margin, padding etc.)
|
87
|
-
- No focus style (`.tna-!--no-focus-style`) for items such as the target element of a skip link
|
88
|
-
- Visibly hidden content (used to add extra descriptions which appear for screenreaders only)
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
2
|
-
|
3
|
-
<Meta title="Development/Using/Compiled" />
|
4
|
-
|
5
|
-
# Using the compiled files
|
6
|
-
|
7
|
-
Each release (as of `v0.1.21-prerelease`) should contain a ZIP of the package.
|
8
|
-
|
9
|
-
Find the release you want on the `tna-frontend` [releases page](https://github.com/nationalarchives/tna-frontend/releases) and download the package from the "Assets" dropdown.
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
2
|
-
|
3
|
-
<Meta title="Development/Using/Hosted" />
|
4
|
-
|
5
|
-
# Using with a hosted solution
|
6
|
-
|
7
|
-
The `@nationalarchives/frontend` package is available on [jsdelivr.com](https://www.jsdelivr.com/package/npm/@nationalarchives/frontend).
|
8
|
-
|
9
|
-
While you can use the CSS and JavaScript from there, the font files which includes the icon font will have to be hosted from your web application.
|
10
|
-
|
11
|
-
As a result, **using a hosted solution is not the preferred method for using the `tna-frontend` library**.
|
12
|
-
|
13
|
-
## All components and styles
|
14
|
-
|
15
|
-
Include the CSS in the `<head>` element of your page:
|
16
|
-
|
17
|
-
```html
|
18
|
-
<link href="https://cdn.jsdelivr.net/npm/@nationalarchives/frontend@0.1.18-prerelease/nationalarchives/all.css" rel="stylesheet" integrity="sha384-6Egfw6aX1Jrwuf+APn+BMPswroudkIQ6StU095OPkNCKLEzj7ksWGmYxjend8P7g" crossorigin="anonymous">
|
19
|
-
```
|
20
|
-
|
21
|
-
### JavaScript
|
22
|
-
|
23
|
-
Add the JavaScript to the end of your page just before your closing `</body>` tag:
|
24
|
-
|
25
|
-
```html
|
26
|
-
<script src="https://cdn.jsdelivr.net/npm/@nationalarchives/frontend@0.1.18-prerelease/nationalarchives/all.js" integrity="sha384-sBkiMlxl9svXopGxNSMVAdALjzyvh6sQHp+21PE3LGfTxAEbG4EIpK" crossorigin="anonymous"></script>
|
27
|
-
<script>
|
28
|
-
// Initialise all TNA components
|
29
|
-
window.TNAFrontend.initAll();
|
30
|
-
</script>
|
31
|
-
```
|
32
|
-
|
33
|
-
...or use the module syntax:
|
34
|
-
|
35
|
-
```
|
36
|
-
<script type="module">
|
37
|
-
import { initAll } from "https://cdn.jsdelivr.net/npm/@nationalarchives/frontend@0.1.18-prerelease/nationalarchives/all.js";
|
38
|
-
initAll();
|
39
|
-
</script>
|
40
|
-
```
|
41
|
-
|
42
|
-
## Specific components
|
43
|
-
|
44
|
-
```html
|
45
|
-
<link href="https://cdn.jsdelivr.net/npm/@nationalarchives/frontend@0.1.18-prerelease/nationalarchives/components/tabs.css" rel="stylesheet" integrity="sha384-hkx4svJn1A7pWYlzaDRMmtIBBijZdEop+M1Y/H4Hdg8aAqZRJHG56RokLk/eqJYl" crossorigin="anonymous">
|
46
|
-
```
|
47
|
-
|
48
|
-
### JavaScript
|
49
|
-
|
50
|
-
```html
|
51
|
-
<!-- JavaScript for a single component -->
|
52
|
-
<script src="https://cdn.jsdelivr.net/npm/@nationalarchives/frontend@0.1.18-prerelease/nationalarchives/components/tabs.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
53
|
-
```
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
2
|
-
|
3
|
-
<Meta title="Development/Using/NPM" />
|
4
|
-
|
5
|
-
# Using with npm
|
6
|
-
|
7
|
-
Install the frontend package from NPM with:
|
8
|
-
|
9
|
-
```sh
|
10
|
-
npm install @nationalarchives/frontend
|
11
|
-
```
|
12
|
-
|
13
|
-
## CSS
|
14
|
-
|
15
|
-
From here, you have access to include the SCSS files from the package so you can compile the package yourself:
|
16
|
-
|
17
|
-
```css
|
18
|
-
// OPTIONAL: Override any variables
|
19
|
-
@use "node_modules/@nationalarchives/frontend/nationalarchives/variables/assets" with (
|
20
|
-
$tna-font-path: "/MY_CUSTOM_FONTS_PATH",
|
21
|
-
$fa-font-path: "/MY_CUSTOM_FONT_AWESOME_PATH"
|
22
|
-
);
|
23
|
-
@use "node_modules/@nationalarchives/frontend/nationalarchives/variables/grid" with (
|
24
|
-
$largest-container-width: 1337px
|
25
|
-
);
|
26
|
-
@use "node_modules/@nationalarchives/frontend/nationalarchives/variables/typography" with (
|
27
|
-
$body-font-size-px: 17
|
28
|
-
);
|
29
|
-
|
30
|
-
// Include all the styles
|
31
|
-
@use "node_modules/@nationalarchives/frontend/nationalarchives/all";
|
32
|
-
|
33
|
-
// ...or just include a single component
|
34
|
-
@use "node_modules/@nationalarchives/frontend/nationalarchives/components/tabs";
|
35
|
-
```
|
36
|
-
|
37
|
-
...or you can copy any of the compiled CSS files into your distribution:
|
38
|
-
|
39
|
-
- `node_modules/@nationalarchives/frontend/nationalarchives/all.css`
|
40
|
-
- `node_modules/@nationalarchives/frontend/nationalarchives/all.css.map`
|
41
|
-
- `node_modules/@nationalarchives/frontend/nationalarchives/components/tabs.css`
|
42
|
-
- `node_modules/@nationalarchives/frontend/nationalarchives/components/tabs.css.map`
|
43
|
-
|
44
|
-
## JavaScript
|
45
|
-
|
46
|
-
```JavaScript
|
47
|
-
// Import all the JavaScript
|
48
|
-
import "node_modules/@nationalarchives/frontend/nationalarchives/all.mjs";
|
49
|
-
|
50
|
-
// ...or import just the JavaScript for a single component
|
51
|
-
import "node_modules/@nationalarchives/frontend/nationalarchives/components/tabs/tabs.mjs";
|
52
|
-
```
|
53
|
-
|
54
|
-
...or you can copy any of the compiled JavaScript files into your distribution:
|
55
|
-
|
56
|
-
- `node_modules/@nationalarchives/frontend/nationalarchives/all.js`
|
57
|
-
- `node_modules/@nationalarchives/frontend/nationalarchives/all.js.map`
|
58
|
-
- `node_modules/@nationalarchives/frontend/nationalarchives/components/tabs.js`
|
59
|
-
- `node_modules/@nationalarchives/frontend/nationalarchives/components/tabs.js.map`
|
File without changes
|