@ilo-org/react 0.2.0 → 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.
- package/CHANGELOG.md +17 -0
- package/lib/cjs/{DailyMotion-4f88e10b.js → DailyMotion-2aa7f048.js} +4 -5
- package/lib/cjs/{Facebook-d993b91c.js → Facebook-87e24af8.js} +4 -5
- package/lib/cjs/{FilePlayer-8272a6ea.js → FilePlayer-e1216cc8.js} +4 -5
- package/lib/cjs/{Kaltura-fbd2c46f.js → Kaltura-a673a8e9.js} +4 -5
- package/lib/cjs/{Mixcloud-2b4ffb85.js → Mixcloud-f9575c31.js} +4 -5
- package/lib/cjs/{Preview-8238ea6e.js → Preview-468c3a7f.js} +2 -2
- package/lib/cjs/{SoundCloud-356fd92d.js → SoundCloud-7c59f293.js} +4 -5
- package/lib/cjs/{Streamable-407ca855.js → Streamable-83e516e5.js} +4 -5
- package/lib/cjs/{Twitch-ca00faaf.js → Twitch-fdfa1c77.js} +4 -5
- package/lib/cjs/VideoPlayer-9ce35136.js +2059 -0
- package/lib/cjs/{Vidyard-9d037503.js → Vidyard-096bba3c.js} +4 -5
- package/lib/cjs/{Vimeo-6898bfd9.js → Vimeo-2cb7476f.js} +4 -5
- package/lib/cjs/{Wistia-ed77bf25.js → Wistia-5e830ac8.js} +4 -5
- package/lib/cjs/{YouTube-909bd761.js → YouTube-25a1d9a0.js} +4 -5
- package/lib/cjs/components/Navigation/Navigation.js +48 -0
- package/lib/cjs/components/Navigation/index.js +20 -0
- package/lib/cjs/components/Video/Video.js +2 -4
- package/lib/cjs/components/Video/VideoPlayer.js +10 -1445
- package/lib/cjs/components/Video/index.js +1 -3
- package/lib/cjs/components/index.js +4 -4
- package/lib/cjs/index.js +3 -3
- package/lib/esm/{DailyMotion-9a7aeab5.js → DailyMotion-66b6eff2.js} +1 -2
- package/lib/esm/{Facebook-eb35da52.js → Facebook-dbd1003d.js} +1 -2
- package/lib/esm/{FilePlayer-22314795.js → FilePlayer-617ed2ce.js} +1 -2
- package/lib/esm/{Kaltura-b97bb455.js → Kaltura-bbcec33d.js} +1 -2
- package/lib/esm/{Mixcloud-41d6dc0b.js → Mixcloud-a681ec69.js} +1 -2
- package/lib/esm/{Preview-6d2a6792.js → Preview-407cc648.js} +1 -1
- package/lib/esm/{SoundCloud-0fac2e7a.js → SoundCloud-16e78ee5.js} +1 -2
- package/lib/esm/{Streamable-46f19a16.js → Streamable-ecb225c1.js} +1 -2
- package/lib/esm/{Twitch-1be39438.js → Twitch-8d1b6769.js} +1 -2
- package/lib/esm/VideoPlayer-62e0ce79.js +2054 -0
- package/lib/esm/{Vidyard-6185c490.js → Vidyard-57e2834a.js} +1 -2
- package/lib/esm/{Vimeo-a807e7e1.js → Vimeo-faa058a2.js} +1 -2
- package/lib/esm/{Wistia-eef03ce2.js → Wistia-24fb5120.js} +1 -2
- package/lib/esm/{YouTube-e030042e.js → YouTube-01b3e51f.js} +1 -2
- package/lib/esm/components/Navigation/Navigation.js +46 -0
- package/lib/esm/components/Navigation/index.js +14 -0
- package/lib/esm/components/Video/Video.js +1 -3
- package/lib/esm/components/Video/VideoPlayer.js +9 -1448
- package/lib/esm/components/Video/index.js +1 -3
- package/lib/esm/components/index.js +3 -4
- package/lib/esm/index.js +2 -3
- package/lib/types/react/src/components/Navigation/Navigation.d.ts +4 -0
- package/lib/types/react/src/components/Navigation/Navigation.props.d.ts +99 -0
- package/lib/types/react/src/components/Navigation/index.d.ts +1 -0
- package/lib/types/react/src/components/index.d.ts +1 -0
- package/package.json +3 -2
- package/public/favicon.ico +0 -0
- package/src/components/Navigation/Navigation.args.ts +112 -0
- package/src/components/Navigation/Navigation.props.ts +120 -0
- package/src/components/Navigation/Navigation.tsx +246 -0
- package/src/components/Navigation/index.ts +1 -0
- package/src/components/index.ts +1 -0
- package/lib/cjs/_commonjsHelpers-9f9f50a8.js +0 -39
- package/lib/cjs/patterns-975adf3c.js +0 -579
- package/lib/esm/_commonjsHelpers-849bcf65.js +0 -35
- package/lib/esm/patterns-53247c1d.js +0 -575
|
@@ -5,9 +5,7 @@ import '../../hooks/useGlobalSettings.js';
|
|
|
5
5
|
import 'tslib';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../GlobalCtx-7fb23cfa.js';
|
|
8
|
-
import '
|
|
9
|
-
import '../../_commonjsHelpers-849bcf65.js';
|
|
10
|
-
import '../../patterns-53247c1d.js';
|
|
8
|
+
import '../../VideoPlayer-62e0ce79.js';
|
|
11
9
|
import '../../index-8ebb2cc1.js';
|
|
12
10
|
import 'react-dom';
|
|
13
11
|
import '../../utils/hoursMinutesSeconds.js';
|
|
@@ -50,6 +50,7 @@ export { default as Profile } from './Profile/Profile.js';
|
|
|
50
50
|
export { default as TableOfContents } from './TableOfContents/TableOfContents.js';
|
|
51
51
|
export { default as Footer } from './Footer/Footer.js';
|
|
52
52
|
export { default as LocalNav } from './LocalNav/LocalNav.js';
|
|
53
|
+
export { default as Navigation } from './Navigation/Navigation.js';
|
|
53
54
|
import '../hooks/useGlobalSettings.js';
|
|
54
55
|
import '../AccordionCtx-8c051900.js';
|
|
55
56
|
import '@ilo-org/utils';
|
|
@@ -61,10 +62,8 @@ import '../utils/getDefaultDimensionValue.js';
|
|
|
61
62
|
import '../css-7414f50b.js';
|
|
62
63
|
import '../utils/transitionEndListener.js';
|
|
63
64
|
import '../utils/triggerBrowserReflow.js';
|
|
64
|
-
import '@ilo-org/icons-react';
|
|
65
65
|
import './Hero/HeroCard.js';
|
|
66
|
-
import '
|
|
67
|
-
import '../_commonjsHelpers-849bcf65.js';
|
|
68
|
-
import '../patterns-53247c1d.js';
|
|
66
|
+
import '../VideoPlayer-62e0ce79.js';
|
|
69
67
|
import '../utils/hoursMinutesSeconds.js';
|
|
70
68
|
import 'screenfull';
|
|
69
|
+
import '@ilo-org/icons-react';
|
package/lib/esm/index.js
CHANGED
|
@@ -50,6 +50,7 @@ export { default as Profile } from './components/Profile/Profile.js';
|
|
|
50
50
|
export { default as TableOfContents } from './components/TableOfContents/TableOfContents.js';
|
|
51
51
|
export { default as Footer } from './components/Footer/Footer.js';
|
|
52
52
|
export { default as LocalNav } from './components/LocalNav/LocalNav.js';
|
|
53
|
+
export { default as Navigation } from './components/Navigation/Navigation.js';
|
|
53
54
|
import './hooks/useGlobalSettings.js';
|
|
54
55
|
import './AccordionCtx-8c051900.js';
|
|
55
56
|
import '@ilo-org/utils';
|
|
@@ -62,9 +63,7 @@ import './css-7414f50b.js';
|
|
|
62
63
|
import './utils/transitionEndListener.js';
|
|
63
64
|
import './utils/triggerBrowserReflow.js';
|
|
64
65
|
import './components/Hero/HeroCard.js';
|
|
65
|
-
import './
|
|
66
|
-
import './_commonjsHelpers-849bcf65.js';
|
|
67
|
-
import './patterns-53247c1d.js';
|
|
66
|
+
import './VideoPlayer-62e0ce79.js';
|
|
68
67
|
import './utils/hoursMinutesSeconds.js';
|
|
69
68
|
import 'screenfull';
|
|
70
69
|
import '@ilo-org/icons-react';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { LinkProps, ContextMenuProps } from "../ContextMenu/ContextMenu.props";
|
|
2
|
+
import { SearchFieldProps } from "../SearchField/SearchField.props";
|
|
3
|
+
export interface NavigationProps {
|
|
4
|
+
/**
|
|
5
|
+
* Props for the logo of the Navigation
|
|
6
|
+
*/
|
|
7
|
+
logo?: Required<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Props for the mobile logo of the Navigation
|
|
10
|
+
*/
|
|
11
|
+
mobilelogo?: Required<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Props for the home url of the Navigation
|
|
14
|
+
*/
|
|
15
|
+
siteurl?: Required<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Specify the tagline for the Navigation
|
|
18
|
+
*/
|
|
19
|
+
tagline?: Required<TaglineProps>;
|
|
20
|
+
/**
|
|
21
|
+
* Specify the primary items for the Navigation
|
|
22
|
+
*/
|
|
23
|
+
primarynav?: Required<PrimaryNavProps>;
|
|
24
|
+
/**
|
|
25
|
+
* Specify the secondary items for the Navigation
|
|
26
|
+
*/
|
|
27
|
+
subnav?: Required<SubNavProps>;
|
|
28
|
+
/**
|
|
29
|
+
* Specify the tagline for the Navigation
|
|
30
|
+
*/
|
|
31
|
+
searchlabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Specify the searchfield props for the Navigation
|
|
34
|
+
*/
|
|
35
|
+
searchfield?: SearchFieldProps;
|
|
36
|
+
/**
|
|
37
|
+
* Specify the menu label for the Navigation
|
|
38
|
+
*/
|
|
39
|
+
menulabel?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Specify the menu close label for the Navigation
|
|
42
|
+
*/
|
|
43
|
+
menucloselabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Specify the language label for the Navigation
|
|
46
|
+
*/
|
|
47
|
+
languagelabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Specify the language context menu for the Navigation
|
|
50
|
+
*/
|
|
51
|
+
languagecontextmenu?: ContextMenuProps;
|
|
52
|
+
}
|
|
53
|
+
interface PrimaryNavProps {
|
|
54
|
+
/**
|
|
55
|
+
* Specify the label for Navigation
|
|
56
|
+
*/
|
|
57
|
+
navlabel?: Required<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Specify the close label for mobile Navigation
|
|
60
|
+
*/
|
|
61
|
+
mobilecloselabel?: Required<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Specify the links
|
|
64
|
+
*/
|
|
65
|
+
items?: Required<Array<LinkProps>>;
|
|
66
|
+
}
|
|
67
|
+
interface SubNavProps {
|
|
68
|
+
/**
|
|
69
|
+
* Specify the label for sub Navigation
|
|
70
|
+
*/
|
|
71
|
+
navlabel?: Required<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Specify the button label for sub Navigation
|
|
74
|
+
*/
|
|
75
|
+
buttonlabel?: Required<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Specify the close label for mobile sub Navigation
|
|
78
|
+
*/
|
|
79
|
+
mobilecloselabel?: Required<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Specify the back label for mobile sub Navigation
|
|
82
|
+
*/
|
|
83
|
+
mobilebacklabel?: Required<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Specify the subnav links
|
|
86
|
+
*/
|
|
87
|
+
items?: Required<Array<LinkProps>>;
|
|
88
|
+
}
|
|
89
|
+
interface TaglineProps {
|
|
90
|
+
/**
|
|
91
|
+
* Specify the main tagline text
|
|
92
|
+
*/
|
|
93
|
+
tag?: Required<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Specify the small tagline text
|
|
96
|
+
*/
|
|
97
|
+
small?: Required<string>;
|
|
98
|
+
}
|
|
99
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Navigation } from "./Navigation";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "React components for the ILO's Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui_patterns",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"designsystem",
|
|
10
10
|
"components"
|
|
11
11
|
],
|
|
12
|
+
"homepage": "https://react.ui.ilo.org",
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
|
14
15
|
"url": "https://github.com/international-labour-organization/designsystem.git",
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
"@ilo-org/brand-assets": "0.1.0",
|
|
75
76
|
"@ilo-org/fonts": "0.1.0",
|
|
76
77
|
"@ilo-org/icons-react": "0.0.18",
|
|
77
|
-
"@ilo-org/styles": "0.1.
|
|
78
|
+
"@ilo-org/styles": "0.1.19",
|
|
78
79
|
"@ilo-org/themes": "0.1.15",
|
|
79
80
|
"@ilo-org/utils": "0.0.11"
|
|
80
81
|
},
|
|
Binary file
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { NavigationProps } from "./Navigation.props";
|
|
2
|
+
import ilo_logo_white from "@ilo-org/brand-assets/logo_en_horizontal_white.svg";
|
|
3
|
+
|
|
4
|
+
const basic: NavigationProps = {
|
|
5
|
+
logo: ilo_logo_white,
|
|
6
|
+
mobilelogo: ilo_logo_white,
|
|
7
|
+
siteurl: "https://www.ilo.org/",
|
|
8
|
+
tagline: {
|
|
9
|
+
tag: "Advancing social justice, promoting decent work",
|
|
10
|
+
small: "ILO is a specialized agency of the United Nations",
|
|
11
|
+
},
|
|
12
|
+
primarynav: {
|
|
13
|
+
navlabel: "Primary Navigation",
|
|
14
|
+
mobilecloselabel: "Close",
|
|
15
|
+
items: [
|
|
16
|
+
{
|
|
17
|
+
label: "Topics",
|
|
18
|
+
url: "https://www.ilo.org",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Countries",
|
|
22
|
+
url: "https://www.ilo.org",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: "Standards",
|
|
26
|
+
url: "https://www.ilo.org",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: "Statistics",
|
|
30
|
+
url: "https://www.ilo.org",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "About",
|
|
34
|
+
url: "https://www.ilo.org",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
subnav: {
|
|
39
|
+
navlabel: "Secondary Navigation",
|
|
40
|
+
buttonlabel: "More",
|
|
41
|
+
mobilecloselabel: "Close",
|
|
42
|
+
mobilebacklabel: "Menu Home",
|
|
43
|
+
items: [
|
|
44
|
+
{
|
|
45
|
+
label: "News",
|
|
46
|
+
url: "https://www.ilo.org",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: "Meeting & Events",
|
|
50
|
+
url: "https://www.ilo.org",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "Publications",
|
|
54
|
+
url: "https://www.ilo.org",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: "Projects",
|
|
58
|
+
url: "https://www.ilo.org",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "Partners",
|
|
62
|
+
url: "https://www.ilo.org",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: "Industries & Sectors",
|
|
66
|
+
url: "https://www.ilo.org",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: "About the ILO",
|
|
70
|
+
url: "https://www.ilo.org",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
languagelabel: "English",
|
|
75
|
+
menulabel: "Menu",
|
|
76
|
+
menucloselabel: "Close",
|
|
77
|
+
languagecontextmenu: {
|
|
78
|
+
links: [
|
|
79
|
+
{
|
|
80
|
+
label: "Français",
|
|
81
|
+
url: "https://www.ilo.org",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: "Español",
|
|
85
|
+
url: "https://www.ilo.org",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: "中文",
|
|
89
|
+
url: "https://www.ilo.org",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: "Русский",
|
|
93
|
+
url: "https://www.ilo.org",
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
searchlabel: "Search",
|
|
98
|
+
searchfield: {
|
|
99
|
+
action: "https://www.ilo.org",
|
|
100
|
+
input: {
|
|
101
|
+
label: "",
|
|
102
|
+
helper: "",
|
|
103
|
+
name: "text",
|
|
104
|
+
placeholder: "Search Field",
|
|
105
|
+
type: "text",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const NavigationArgs = { basic };
|
|
111
|
+
|
|
112
|
+
export default NavigationArgs;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { LinkProps, ContextMenuProps } from "../ContextMenu/ContextMenu.props";
|
|
2
|
+
import { SearchFieldProps } from "../SearchField/SearchField.props";
|
|
3
|
+
|
|
4
|
+
export interface NavigationProps {
|
|
5
|
+
/**
|
|
6
|
+
* Props for the logo of the Navigation
|
|
7
|
+
*/
|
|
8
|
+
logo?: Required<string>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Props for the mobile logo of the Navigation
|
|
12
|
+
*/
|
|
13
|
+
mobilelogo?: Required<string>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Props for the home url of the Navigation
|
|
17
|
+
*/
|
|
18
|
+
siteurl?: Required<string>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Specify the tagline for the Navigation
|
|
22
|
+
*/
|
|
23
|
+
tagline?: Required<TaglineProps>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Specify the primary items for the Navigation
|
|
27
|
+
*/
|
|
28
|
+
primarynav?: Required<PrimaryNavProps>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Specify the secondary items for the Navigation
|
|
32
|
+
*/
|
|
33
|
+
subnav?: Required<SubNavProps>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Specify the tagline for the Navigation
|
|
37
|
+
*/
|
|
38
|
+
searchlabel?: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Specify the searchfield props for the Navigation
|
|
42
|
+
*/
|
|
43
|
+
searchfield?: SearchFieldProps;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Specify the menu label for the Navigation
|
|
47
|
+
*/
|
|
48
|
+
menulabel?: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Specify the menu close label for the Navigation
|
|
52
|
+
*/
|
|
53
|
+
menucloselabel?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Specify the language label for the Navigation
|
|
57
|
+
*/
|
|
58
|
+
languagelabel?: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Specify the language context menu for the Navigation
|
|
62
|
+
*/
|
|
63
|
+
languagecontextmenu?: ContextMenuProps;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface PrimaryNavProps {
|
|
67
|
+
/**
|
|
68
|
+
* Specify the label for Navigation
|
|
69
|
+
*/
|
|
70
|
+
navlabel?: Required<string>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Specify the close label for mobile Navigation
|
|
74
|
+
*/
|
|
75
|
+
mobilecloselabel?: Required<string>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Specify the links
|
|
79
|
+
*/
|
|
80
|
+
items?: Required<Array<LinkProps>>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface SubNavProps {
|
|
84
|
+
/**
|
|
85
|
+
* Specify the label for sub Navigation
|
|
86
|
+
*/
|
|
87
|
+
navlabel?: Required<string>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Specify the button label for sub Navigation
|
|
91
|
+
*/
|
|
92
|
+
buttonlabel?: Required<string>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Specify the close label for mobile sub Navigation
|
|
96
|
+
*/
|
|
97
|
+
mobilecloselabel?: Required<string>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Specify the back label for mobile sub Navigation
|
|
101
|
+
*/
|
|
102
|
+
mobilebacklabel?: Required<string>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Specify the subnav links
|
|
106
|
+
*/
|
|
107
|
+
items?: Required<Array<LinkProps>>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface TaglineProps {
|
|
111
|
+
/**
|
|
112
|
+
* Specify the main tagline text
|
|
113
|
+
*/
|
|
114
|
+
tag?: Required<string>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Specify the small tagline text
|
|
118
|
+
*/
|
|
119
|
+
small?: Required<string>;
|
|
120
|
+
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { FC, useState } from "react";
|
|
2
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
3
|
+
import { ContextMenu } from "../ContextMenu";
|
|
4
|
+
import { SearchField } from "../SearchField";
|
|
5
|
+
import { NavigationProps } from "./Navigation.props";
|
|
6
|
+
import classnames from "classnames";
|
|
7
|
+
|
|
8
|
+
const Navigation: FC<NavigationProps> = ({
|
|
9
|
+
logo,
|
|
10
|
+
mobilelogo,
|
|
11
|
+
siteurl,
|
|
12
|
+
tagline,
|
|
13
|
+
primarynav,
|
|
14
|
+
subnav,
|
|
15
|
+
menulabel,
|
|
16
|
+
menucloselabel,
|
|
17
|
+
searchlabel,
|
|
18
|
+
searchfield,
|
|
19
|
+
languagelabel,
|
|
20
|
+
languagecontextmenu,
|
|
21
|
+
}) => {
|
|
22
|
+
const { prefix } = useGlobalSettings();
|
|
23
|
+
|
|
24
|
+
const [toggleMenuOpen, setMenuToggleOpen] = useState(false);
|
|
25
|
+
const [toggleSearchOpen, setSearchToggleOpen] = useState(false);
|
|
26
|
+
const [toggleSubnavOpen, setSubnavToggleOpen] = useState(false);
|
|
27
|
+
const [toggleLanguageOpen, setLanguageToggleOpen] = useState(false);
|
|
28
|
+
|
|
29
|
+
const baseClass = `${prefix}--header`;
|
|
30
|
+
const NavigationClasses = classnames(baseClass, {
|
|
31
|
+
[`${prefix}--mobile--open`]: toggleMenuOpen,
|
|
32
|
+
[`${prefix}--select--open`]: toggleLanguageOpen,
|
|
33
|
+
[`${prefix}--search--open`]: toggleSearchOpen,
|
|
34
|
+
[`${prefix}--subnav--open`]: toggleSubnavOpen,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const handleMenuToggle = () => {
|
|
38
|
+
setMenuToggleOpen(!toggleMenuOpen);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const handleLanguageToggle = () => {
|
|
42
|
+
setLanguageToggleOpen(!toggleLanguageOpen);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const handleSearchToggle = () => {
|
|
46
|
+
setSearchToggleOpen(!toggleSearchOpen);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const handleSubnavToggle = () => {
|
|
50
|
+
setSubnavToggleOpen(!toggleSubnavOpen);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<header className={NavigationClasses}>
|
|
55
|
+
<div className={`${baseClass}--utility-bar`}>
|
|
56
|
+
<div className={`${prefix}--language-switcher`}>
|
|
57
|
+
<div className={`${prefix}--language-switcher--wrap`}>
|
|
58
|
+
<button
|
|
59
|
+
className={`${prefix}--language-switcher--button`}
|
|
60
|
+
type="button"
|
|
61
|
+
>
|
|
62
|
+
{languagelabel}
|
|
63
|
+
</button>
|
|
64
|
+
<ContextMenu links={languagecontextmenu?.links}></ContextMenu>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<div className={`${baseClass}--logo-bar`}>
|
|
69
|
+
<div className={`${baseClass}--inner`}>
|
|
70
|
+
<a href={siteurl} className={`${baseClass}--logo-link`}>
|
|
71
|
+
<img className={`${baseClass}--logo`} src={logo} alt="ILO Logo" />
|
|
72
|
+
</a>
|
|
73
|
+
<p className={`${baseClass}--logo-tagline`}>
|
|
74
|
+
{tagline?.tag}
|
|
75
|
+
<span className={`${baseClass}--logo-tagline--small`}>
|
|
76
|
+
{tagline?.small}
|
|
77
|
+
</span>
|
|
78
|
+
</p>
|
|
79
|
+
<button className={`${baseClass}--menu`} onClick={handleMenuToggle}>
|
|
80
|
+
{menulabel}
|
|
81
|
+
</button>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<div className={`${baseClass}--navigation`}>
|
|
85
|
+
<div className={`${baseClass}--inner`}>
|
|
86
|
+
<div className={`${prefix}--mobile--nav`}>
|
|
87
|
+
<div className={`${prefix}--mobile--nav--logo`}>
|
|
88
|
+
<a href={siteurl} className={`${baseClass}--logo-link`}>
|
|
89
|
+
<img
|
|
90
|
+
className={`${baseClass}--logo`}
|
|
91
|
+
src={mobilelogo}
|
|
92
|
+
alt="ILO Logo"
|
|
93
|
+
/>
|
|
94
|
+
</a>
|
|
95
|
+
<button
|
|
96
|
+
className={`${baseClass}--menu--close`}
|
|
97
|
+
onClick={handleMenuToggle}
|
|
98
|
+
>
|
|
99
|
+
{menucloselabel}
|
|
100
|
+
</button>
|
|
101
|
+
</div>
|
|
102
|
+
<div className={`${prefix}--mobile--nav--search`}>
|
|
103
|
+
<SearchField
|
|
104
|
+
input={searchfield?.input}
|
|
105
|
+
action={searchfield?.action}
|
|
106
|
+
></SearchField>
|
|
107
|
+
</div>
|
|
108
|
+
<div className={`${prefix}--mobile--nav--language--switcher`}>
|
|
109
|
+
<button
|
|
110
|
+
className={`${prefix}--mobile--nav--language--switcher--button`}
|
|
111
|
+
onClick={handleLanguageToggle}
|
|
112
|
+
type="button"
|
|
113
|
+
>
|
|
114
|
+
{languagelabel}
|
|
115
|
+
</button>
|
|
116
|
+
</div>
|
|
117
|
+
<div className={`${prefix}--mobile--nav--language--select`}>
|
|
118
|
+
<div className={`${baseClass}--inner`}>
|
|
119
|
+
<div className={`${prefix}--mobile--subnav--menu`}>
|
|
120
|
+
<button
|
|
121
|
+
className={`${prefix}--mobile--subnav--back`}
|
|
122
|
+
onClick={handleLanguageToggle}
|
|
123
|
+
type="button"
|
|
124
|
+
>
|
|
125
|
+
{subnav?.mobilebacklabel}
|
|
126
|
+
</button>
|
|
127
|
+
<button
|
|
128
|
+
className={`${baseClass}--menu--close`}
|
|
129
|
+
onClick={handleMenuToggle}
|
|
130
|
+
>
|
|
131
|
+
{subnav?.mobilecloselabel}
|
|
132
|
+
</button>
|
|
133
|
+
<h6 className={`${prefix}--mobile--subnav--label`}>
|
|
134
|
+
{languagelabel}
|
|
135
|
+
</h6>
|
|
136
|
+
</div>
|
|
137
|
+
<ul className={`${prefix}--nav--set`}>
|
|
138
|
+
{languagecontextmenu?.links &&
|
|
139
|
+
languagecontextmenu.links.map((item, index) => (
|
|
140
|
+
<li className={`${prefix}--nav--items`} key={index}>
|
|
141
|
+
<a
|
|
142
|
+
href={item.url}
|
|
143
|
+
className={`${prefix}--nav--link ${prefix}--nav--language`}
|
|
144
|
+
>
|
|
145
|
+
{item.label}
|
|
146
|
+
</a>
|
|
147
|
+
</li>
|
|
148
|
+
))}
|
|
149
|
+
</ul>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
<nav
|
|
154
|
+
className={`${prefix}--nav`}
|
|
155
|
+
aria-labelledby="primary-navigation"
|
|
156
|
+
>
|
|
157
|
+
<h2 className={`${prefix}--nav--label`} id="primary-navigation">
|
|
158
|
+
{primarynav?.navlabel}
|
|
159
|
+
</h2>
|
|
160
|
+
<ul className={`${prefix}--nav--set`}>
|
|
161
|
+
{primarynav?.items &&
|
|
162
|
+
primarynav.items.map((item, index) => (
|
|
163
|
+
<li className={`${prefix}--nav--items`} key={index}>
|
|
164
|
+
<a href={item.url} className={`${prefix}--nav--link`}>
|
|
165
|
+
{item.label}
|
|
166
|
+
</a>
|
|
167
|
+
</li>
|
|
168
|
+
))}
|
|
169
|
+
{subnav && (
|
|
170
|
+
<li className={`${prefix}--nav--items`}>
|
|
171
|
+
<button
|
|
172
|
+
className={`${prefix}--nav--trigger`}
|
|
173
|
+
onClick={handleSubnavToggle}
|
|
174
|
+
>
|
|
175
|
+
{subnav.buttonlabel}
|
|
176
|
+
</button>
|
|
177
|
+
</li>
|
|
178
|
+
)}
|
|
179
|
+
</ul>
|
|
180
|
+
</nav>
|
|
181
|
+
<div className={`${prefix}--search`}>
|
|
182
|
+
<button
|
|
183
|
+
className={`${prefix}--search--button`}
|
|
184
|
+
type="button"
|
|
185
|
+
onClick={handleSearchToggle}
|
|
186
|
+
>
|
|
187
|
+
{searchlabel}
|
|
188
|
+
</button>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
{subnav && (
|
|
192
|
+
<nav
|
|
193
|
+
className={`${prefix}--subnav`}
|
|
194
|
+
aria-labelledby="secondary-navigation"
|
|
195
|
+
>
|
|
196
|
+
<div className={`${prefix}--subnav--inner`}>
|
|
197
|
+
<div className={`${prefix}--mobile--subnav`}>
|
|
198
|
+
<div className={`${prefix}--mobile--subnav--menu`}>
|
|
199
|
+
<button
|
|
200
|
+
className={`${prefix}--mobile--subnav--back`}
|
|
201
|
+
onClick={handleSubnavToggle}
|
|
202
|
+
type="button"
|
|
203
|
+
>
|
|
204
|
+
{subnav.mobilebacklabel}
|
|
205
|
+
</button>
|
|
206
|
+
<button
|
|
207
|
+
className={`${prefix}--header--menu--close`}
|
|
208
|
+
onClick={handleMenuToggle}
|
|
209
|
+
>
|
|
210
|
+
{subnav.mobilecloselabel}
|
|
211
|
+
</button>
|
|
212
|
+
<h6 className={`${prefix}--mobile--subnav--label`}>
|
|
213
|
+
{subnav.buttonlabel}
|
|
214
|
+
</h6>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
<h2 className={`${prefix}--nav--label`} id="secondary-navigation">
|
|
218
|
+
{subnav.navlabel}
|
|
219
|
+
</h2>
|
|
220
|
+
<ul className={`${prefix}--subnav--set`}>
|
|
221
|
+
{subnav?.items &&
|
|
222
|
+
subnav.items.map((item, index) => (
|
|
223
|
+
<li className={`${prefix}--subnav--items`} key={index}>
|
|
224
|
+
<a href={item.url} className={`${prefix}--subnav--link`}>
|
|
225
|
+
{item.label}
|
|
226
|
+
</a>
|
|
227
|
+
</li>
|
|
228
|
+
))}
|
|
229
|
+
</ul>
|
|
230
|
+
</div>
|
|
231
|
+
</nav>
|
|
232
|
+
)}
|
|
233
|
+
<div className={`${prefix}--search-box`}>
|
|
234
|
+
<div className={`${prefix}--header--inner`}>
|
|
235
|
+
<SearchField
|
|
236
|
+
input={searchfield?.input}
|
|
237
|
+
action={searchfield?.action}
|
|
238
|
+
></SearchField>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
</div>
|
|
242
|
+
</header>
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export default Navigation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Navigation } from "./Navigation";
|
package/src/components/index.ts
CHANGED