@financial-times/dotcom-ui-layout 7.3.0 → 7.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/dotcom-ui-layout",
3
- "version": "7.3.0",
3
+ "version": "7.3.1",
4
4
  "description": "",
5
5
  "main": "component.js",
6
6
  "browser": "browser.js",
@@ -8,13 +8,12 @@
8
8
  "styles": "styles.scss",
9
9
  "scripts": {
10
10
  "test": "echo \"Error: no test specified\" && exit 1",
11
- "tsc": "../../node_modules/.bin/tsc --incremental",
12
11
  "clean": "npm run clean:dist && npm run clean:node_modules",
13
12
  "clean:dist": "rm -rf dist",
14
13
  "clean:node_modules": "rm -rf node_modules",
15
14
  "clean:install": "npm run clean && npm i",
16
- "build:node": "npm run tsc -- --module commonjs --outDir ./dist/node",
17
- "build:browser": "npm run tsc -- --module es2015 --outDir ./dist/browser",
15
+ "build:browser": "tsc --module es2015 --outDir ./dist/browser",
16
+ "build:node": "tsc",
18
17
  "build": "npm run build:node && npm run build:browser",
19
18
  "dev": "echo -n node browser | parallel -u -d ' ' npm run build:{} -- --watch",
20
19
  "preinstall": "[ \"$INIT_CWD\" != \"$PWD\" ] || npm_config_yes=true npx check-engine"
@@ -23,10 +22,10 @@
23
22
  "author": "",
24
23
  "license": "MIT",
25
24
  "dependencies": {
26
- "@financial-times/dotcom-types-navigation": "^7.3.0",
27
- "@financial-times/dotcom-ui-base-styles": "^7.3.0",
28
- "@financial-times/dotcom-ui-footer": "^7.3.0",
29
- "@financial-times/dotcom-ui-header": "^7.3.0",
25
+ "@financial-times/dotcom-types-navigation": "file:../dotcom-types-navigation",
26
+ "@financial-times/dotcom-ui-base-styles": "file:../dotcom-ui-base-styles",
27
+ "@financial-times/dotcom-ui-footer": "file:../dotcom-ui-footer",
28
+ "@financial-times/dotcom-ui-header": "file:../dotcom-ui-header",
30
29
  "focus-visible": "^5.0.0",
31
30
  "n-ui-foundations": "^9.0.0"
32
31
  },
@@ -37,6 +36,9 @@
37
36
  "node": ">= 14.0.0",
38
37
  "npm": "7.x || 8.x"
39
38
  },
39
+ "files": [
40
+ "dist/"
41
+ ],
40
42
  "repository": {
41
43
  "type": "git",
42
44
  "repository": "https://github.com/Financial-Times/dotcom-page-kit.git",
@@ -50,4 +52,4 @@
50
52
  "check-engine": "^1.10.1",
51
53
  "react": "^16.8.6"
52
54
  }
53
- }
55
+ }
@@ -1,125 +0,0 @@
1
- import React from 'react'
2
- import {
3
- Header as HeaderSimple,
4
- Header as HeaderLarge,
5
- LogoOnly,
6
- NoOutboundLinksHeader,
7
- Drawer,
8
- THeaderOptions
9
- } from '@financial-times/dotcom-ui-header/component'
10
- import { TNavigationData } from '@financial-times/dotcom-types-navigation'
11
- import { Footer, LegalFooter, TFooterOptions } from '@financial-times/dotcom-ui-footer/component'
12
- import Template from './Template'
13
-
14
- enum Headers {
15
- simple = HeaderSimple,
16
- 'large-logo' = HeaderLarge,
17
- 'logo-only' = LogoOnly,
18
- 'no-outbound-links' = NoOutboundLinksHeader
19
- }
20
-
21
- enum Footers {
22
- simple = Footer,
23
- legal = LegalFooter
24
- }
25
-
26
- export type TLayoutProps = {
27
- navigationData?: TNavigationData
28
- headerOptions?: THeaderOptions
29
- headerBefore?: string | React.ReactNode
30
- headerVariant?: Headers | false
31
- headerComponent?: React.ReactNode
32
- headerAfter?: string | React.ReactNode
33
- footerOptions?: TFooterOptions
34
- footerBefore?: string | React.ReactNode
35
- footerVariant?: Footers | false
36
- footerComponent?: React.ReactNode
37
- footerAfter?: string | React.ReactNode
38
- children?: React.ReactNode
39
- contents?: string
40
- }
41
-
42
- export function Layout({
43
- navigationData,
44
- headerOptions,
45
- headerBefore,
46
- headerVariant,
47
- headerComponent,
48
- headerAfter,
49
- footerOptions,
50
- footerBefore,
51
- footerVariant,
52
- footerComponent,
53
- footerAfter,
54
- children,
55
- contents
56
- }: TLayoutProps) {
57
- let header = null
58
- let drawer = null
59
-
60
- if (headerVariant && Headers[headerVariant] && !headerComponent) {
61
- const Header = Headers[headerVariant]
62
- header = <Header {...headerOptions} data={navigationData} variant={headerVariant} />
63
-
64
- if (Header === HeaderSimple || Header === HeaderLarge) {
65
- drawer = <Drawer {...headerOptions} data={navigationData} />
66
- }
67
- }
68
-
69
- let footer = null
70
-
71
- if (footerVariant && Footers[footerVariant] && !footerComponent) {
72
- const Footer = Footers[footerVariant]
73
- footer = <Footer {...footerOptions} data={navigationData} variant={footerVariant} />
74
- }
75
-
76
- return (
77
- <div className="n-layout">
78
- <a
79
- data-trackable="a11y-skip-to-help"
80
- className="n-layout__skip-link"
81
- href="https://www.ft.com/accessibility">
82
- Accessibility help
83
- </a>
84
-
85
- {drawer ? (
86
- <a data-trackable="a11y-skip-to-navigation" className="n-layout__skip-link" href="#site-navigation">
87
- Skip to navigation
88
- </a>
89
- ) : null}
90
-
91
- <a data-trackable="a11y-skip-to-content" className="n-layout__skip-link" href="#site-content">
92
- Skip to content
93
- </a>
94
-
95
- {footer ? (
96
- <a data-trackable="a11y-skip-to-footer" className="n-layout__skip-link" href="#site-footer">
97
- Skip to footer
98
- </a>
99
- ) : null}
100
-
101
- <div className="n-layout__row n-layout__row--header">
102
- <Template className="n-layout__header-before">{headerBefore}</Template>
103
- {headerComponent || header || null}
104
- <Template className="n-layout__header-after">{headerAfter}</Template>
105
- </div>
106
- <div className="n-layout__row n-layout__row--content">
107
- <Template>{contents || children}</Template>
108
- </div>
109
- <div className="n-layout__row n-layout__row--footer">
110
- <Template className="n-layout__footer-before">{footerBefore}</Template>
111
- {footerComponent || footer || null}
112
- <Template className="n-layout__footer-after">{footerAfter}</Template>
113
- </div>
114
-
115
- {drawer}
116
- </div>
117
- )
118
- }
119
-
120
- Layout.defaultProps = {
121
- headerVariant: 'simple',
122
- footerVariant: 'simple',
123
- headerOptions: {},
124
- footerOptions: {}
125
- }
@@ -1,18 +0,0 @@
1
- import React from 'react'
2
-
3
- type TTemplateProps = {
4
- children?: string | React.ReactNode
5
- [rest: string]: any
6
- }
7
-
8
- export default function Template(props: TTemplateProps) {
9
- const { children, ...rest } = props
10
-
11
- if (!children) return null
12
-
13
- if (typeof children === 'string') {
14
- return <div {...rest} dangerouslySetInnerHTML={{ __html: children }} />
15
- } else {
16
- return <div {...rest}>{children}</div>
17
- }
18
- }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components/Layout'
package/styles.scss DELETED
@@ -1,50 +0,0 @@
1
- // This is needed by Origami components that speak to the image service. Setting
2
- // it here means it'll be the same no matter which app generates it and it will
3
- // be reused from the CDN
4
- $system-code: 'page-kit-layout' !default;
5
-
6
- @import '@financial-times/dotcom-ui-base-styles/styles';
7
-
8
- .n-layout {
9
- display: table;
10
- width: 100%;
11
- height: 100vh;
12
- table-layout: fixed;
13
- }
14
-
15
- .n-layout__row {
16
- display: table-row;
17
- }
18
-
19
- .n-layout__row--content {
20
- height: 100%;
21
- }
22
-
23
- .n-layout__header-before {
24
- background-color: oColorsByName('black-20')
25
- }
26
-
27
- .n-layout__skip-link {
28
- @include nUiZIndexFor('notification');
29
- position: absolute;
30
- top: 1em;
31
- left: -9999px;
32
- padding: 0.5em 1em;
33
- background: oColorsByName('velvet');
34
- color: oColorsByName('white');
35
-
36
- &:focus {
37
- left: 0;
38
- color: oColorsByName('white');
39
- }
40
- }
41
-
42
- @media print {
43
- .n-layout,
44
- .n-layout__row {
45
- display: block;
46
- }
47
- }
48
-
49
- @import '@financial-times/dotcom-ui-header/styles';
50
- @import '@financial-times/dotcom-ui-footer/styles';