@ilo-org/react 0.1.1 → 0.2.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 +24 -0
- package/lib/cjs/{DailyMotion-97d1831a.js → DailyMotion-4f88e10b.js} +1 -1
- package/lib/cjs/{Facebook-ccb27d1d.js → Facebook-d993b91c.js} +1 -1
- package/lib/cjs/{FilePlayer-81b9fc3f.js → FilePlayer-8272a6ea.js} +1 -1
- package/lib/cjs/{Kaltura-d6c19814.js → Kaltura-fbd2c46f.js} +1 -1
- package/lib/cjs/{Mixcloud-f02a460e.js → Mixcloud-2b4ffb85.js} +1 -1
- package/lib/cjs/{SoundCloud-cd1b1590.js → SoundCloud-356fd92d.js} +1 -1
- package/lib/cjs/{Streamable-f47da42a.js → Streamable-407ca855.js} +1 -1
- package/lib/cjs/{Twitch-c503e140.js → Twitch-ca00faaf.js} +1 -1
- package/lib/cjs/{Vidyard-d9c2f073.js → Vidyard-9d037503.js} +1 -1
- package/lib/cjs/{Vimeo-009601ef.js → Vimeo-6898bfd9.js} +1 -1
- package/lib/cjs/{Wistia-8c9f4c58.js → Wistia-ed77bf25.js} +1 -1
- package/lib/cjs/{YouTube-ec5847d4.js → YouTube-909bd761.js} +1 -1
- package/lib/cjs/components/Footer/Footer.js +23 -0
- package/lib/cjs/components/Footer/index.js +18 -0
- package/lib/cjs/components/LocalNav/LocalNav.js +102 -0
- package/lib/cjs/components/LocalNav/index.js +14 -0
- package/lib/cjs/components/Video/Video.js +1 -1
- package/lib/cjs/components/Video/VideoPlayer.js +13 -13
- package/lib/cjs/components/Video/index.js +1 -1
- package/lib/cjs/components/index.js +5 -1
- package/lib/cjs/index.js +5 -1
- package/lib/cjs/{patterns-b55db71f.js → patterns-975adf3c.js} +1 -1
- package/lib/esm/{DailyMotion-b35dc8bb.js → DailyMotion-9a7aeab5.js} +1 -1
- package/lib/esm/{Facebook-c3c77787.js → Facebook-eb35da52.js} +1 -1
- package/lib/esm/{FilePlayer-540e4c5a.js → FilePlayer-22314795.js} +1 -1
- package/lib/esm/{Kaltura-4ac3cda3.js → Kaltura-b97bb455.js} +1 -1
- package/lib/esm/{Mixcloud-3d4e0760.js → Mixcloud-41d6dc0b.js} +1 -1
- package/lib/esm/{SoundCloud-306d6c78.js → SoundCloud-0fac2e7a.js} +1 -1
- package/lib/esm/{Streamable-aa3d544e.js → Streamable-46f19a16.js} +1 -1
- package/lib/esm/{Twitch-4a1a1565.js → Twitch-1be39438.js} +1 -1
- package/lib/esm/{Vidyard-fe74c274.js → Vidyard-6185c490.js} +1 -1
- package/lib/esm/{Vimeo-074f2c39.js → Vimeo-a807e7e1.js} +1 -1
- package/lib/esm/{Wistia-0a2b73b0.js → Wistia-eef03ce2.js} +1 -1
- package/lib/esm/{YouTube-d58f130b.js → YouTube-e030042e.js} +1 -1
- package/lib/esm/components/Footer/Footer.js +21 -0
- package/lib/esm/components/Footer/index.js +12 -0
- package/lib/esm/components/LocalNav/LocalNav.js +100 -0
- package/lib/esm/components/LocalNav/index.js +8 -0
- package/lib/esm/components/Video/Video.js +1 -1
- package/lib/esm/components/Video/VideoPlayer.js +13 -13
- package/lib/esm/components/Video/index.js +1 -1
- package/lib/esm/components/index.js +3 -1
- package/lib/esm/index.js +3 -1
- package/lib/esm/{patterns-3a3fa9d6.js → patterns-53247c1d.js} +1 -1
- package/lib/types/react/src/components/ContextMenu/ContextMenu.props.d.ts +1 -2
- package/lib/types/react/src/components/Footer/Footer.d.ts +4 -0
- package/lib/types/react/src/components/Footer/Footer.props.d.ts +70 -0
- package/lib/types/react/src/components/Footer/index.d.ts +1 -0
- package/lib/types/react/src/components/LinkList/LinkList.props.d.ts +2 -3
- package/lib/types/react/src/components/LocalNav/LocalNav.d.ts +4 -0
- package/lib/types/react/src/components/LocalNav/LocalNav.props.d.ts +50 -0
- package/lib/types/react/src/components/LocalNav/index.d.ts +1 -0
- package/lib/types/react/src/components/index.d.ts +2 -0
- package/lib/types/react/src/types/index.d.ts +1 -0
- package/package.json +15 -6
- package/src/components/ContextMenu/ContextMenu.props.ts +1 -1
- package/src/components/Footer/Footer.args.ts +105 -0
- package/src/components/Footer/Footer.props.ts +84 -0
- package/src/components/Footer/Footer.tsx +107 -0
- package/src/components/Footer/index.ts +1 -0
- package/src/components/LinkList/LinkList.props.ts +2 -2
- package/src/components/LocalNav/LocalNav.args.ts +64 -0
- package/src/components/LocalNav/LocalNav.props.ts +60 -0
- package/src/components/LocalNav/LocalNav.tsx +175 -0
- package/src/components/LocalNav/index.ts +1 -0
- package/src/components/index.ts +2 -0
- package/src/declarations.d.ts +14 -0
- package/src/types/index.ts +1 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { FooterProps } from "./Footer.props";
|
|
2
|
+
import ilo_logo_white from "@ilo-org/brand-assets/logo_en_horizontal_white.svg";
|
|
3
|
+
|
|
4
|
+
const basic: FooterProps = {
|
|
5
|
+
className: "footer",
|
|
6
|
+
logo: ilo_logo_white,
|
|
7
|
+
tagline: "Advancing social justice, promoting decent work",
|
|
8
|
+
subtagline: "ILO is a specialized agency of the United Nations",
|
|
9
|
+
address: [
|
|
10
|
+
"International Labour Organization",
|
|
11
|
+
"4 route des Morillons",
|
|
12
|
+
"CH-1211 Genève 22",
|
|
13
|
+
"Switzerland",
|
|
14
|
+
],
|
|
15
|
+
linkgroup: [
|
|
16
|
+
{
|
|
17
|
+
links: [
|
|
18
|
+
{
|
|
19
|
+
label: "Link One",
|
|
20
|
+
url: "https://www.ilo.org",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "Link Two",
|
|
24
|
+
url: "https://www.ilo.org",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Link Three",
|
|
28
|
+
url: "https://www.ilo.org",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Link Four",
|
|
32
|
+
url: "https://www.ilo.org",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "Link Five",
|
|
36
|
+
url: "https://www.ilo.org",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "Link Six",
|
|
40
|
+
url: "https://www.ilo.org",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
socials: {
|
|
46
|
+
headline: "Social Links Headline",
|
|
47
|
+
links: [
|
|
48
|
+
{
|
|
49
|
+
type: "instagram",
|
|
50
|
+
url: "https://www.instagram.com/iloinfo/",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: "facebook",
|
|
54
|
+
url: "https://www.facebook.com/ILO.ORG/",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "twitter",
|
|
58
|
+
url: "https://twitter.com/ILO/",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: "youtube",
|
|
62
|
+
url: "https://youtube.com/@ILO/featured/",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
subscribe: {
|
|
67
|
+
label: "Subscribe",
|
|
68
|
+
url: "https://www.ilo.org",
|
|
69
|
+
},
|
|
70
|
+
legal: "© 1996-2023 International Labour Organization (ILO)",
|
|
71
|
+
secondarylinks: [
|
|
72
|
+
{
|
|
73
|
+
label: "Link One",
|
|
74
|
+
url: "https://www.ilo.org",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: "Link Two",
|
|
78
|
+
url: "https://www.ilo.org",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: "Link Three",
|
|
82
|
+
url: "https://www.ilo.org",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: "Link Four",
|
|
86
|
+
url: "https://www.ilo.org",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: "Link Five",
|
|
90
|
+
url: "https://www.ilo.org",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "Link Six",
|
|
94
|
+
url: "https://www.ilo.org",
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
anchorlink: {
|
|
98
|
+
label: "Back to Top",
|
|
99
|
+
url: "#anchor",
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const FooterArgs = { basic };
|
|
104
|
+
|
|
105
|
+
export default FooterArgs;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { LinkGroupProps } from "../LinkList/LinkList.props";
|
|
2
|
+
import { LinkProps } from "../LinkList/LinkList.props";
|
|
3
|
+
import { SocialTypes } from "../../types";
|
|
4
|
+
|
|
5
|
+
export interface FooterProps {
|
|
6
|
+
/**
|
|
7
|
+
* Specify an optional className to be added to your Footer.
|
|
8
|
+
*/
|
|
9
|
+
className?: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Props for the logo of the Footer
|
|
13
|
+
*/
|
|
14
|
+
logo?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Specify the tagline for the Footer
|
|
18
|
+
*/
|
|
19
|
+
tagline?: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Specify the subtagline for the Footer
|
|
23
|
+
*/
|
|
24
|
+
subtagline?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Specify the address for the Footer, in multiple lines
|
|
28
|
+
*/
|
|
29
|
+
address?: string[];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Specify the linkgroup for the Footer's links
|
|
33
|
+
*/
|
|
34
|
+
linkgroup?: Required<Array<LinkGroupProps>>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Specify the links to be displayed in this link group
|
|
38
|
+
*/
|
|
39
|
+
socials?: FooterSocialProps;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Specify the legal statement for the Footer
|
|
43
|
+
*/
|
|
44
|
+
subscribe?: LinkProps;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Specify the legal statement for the Footer
|
|
48
|
+
*/
|
|
49
|
+
legal?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Specify the secondary links for the Footer
|
|
53
|
+
*/
|
|
54
|
+
secondarylinks?: LinkProps[];
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Specify the anchor link for the Footer
|
|
58
|
+
*/
|
|
59
|
+
anchorlink?: LinkProps;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface FooterSocialProps {
|
|
63
|
+
/**
|
|
64
|
+
* Specify the headline for social links
|
|
65
|
+
*/
|
|
66
|
+
headline?: Required<string>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Specify the social links
|
|
70
|
+
*/
|
|
71
|
+
links?: Required<SocialLinkProps>[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface SocialLinkProps {
|
|
75
|
+
/**
|
|
76
|
+
* Specify the type for social link
|
|
77
|
+
*/
|
|
78
|
+
type?: Required<SocialTypes>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Specify the url for social link
|
|
82
|
+
*/
|
|
83
|
+
url?: Required<string>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
3
|
+
import classnames from "classnames";
|
|
4
|
+
import { FooterProps } from "./Footer.props";
|
|
5
|
+
import { LinkList } from "../LinkList";
|
|
6
|
+
import { Button } from "../Button";
|
|
7
|
+
|
|
8
|
+
const Footer: FC<FooterProps> = ({
|
|
9
|
+
className,
|
|
10
|
+
logo,
|
|
11
|
+
tagline,
|
|
12
|
+
subtagline,
|
|
13
|
+
address,
|
|
14
|
+
linkgroup,
|
|
15
|
+
socials,
|
|
16
|
+
subscribe,
|
|
17
|
+
legal,
|
|
18
|
+
secondarylinks,
|
|
19
|
+
anchorlink,
|
|
20
|
+
}) => {
|
|
21
|
+
const { prefix } = useGlobalSettings();
|
|
22
|
+
|
|
23
|
+
const baseClass = `${prefix}--footer`;
|
|
24
|
+
const footerClasses = classnames(className, baseClass);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<footer className={footerClasses}>
|
|
28
|
+
<div className={`${baseClass}--main`}>
|
|
29
|
+
<div className="site--info">
|
|
30
|
+
<img className={`${baseClass}--logo`} src={logo} alt="ILO Logo" />
|
|
31
|
+
<h3 className={`${baseClass}--headline`}>{tagline}</h3>
|
|
32
|
+
<h4 className={`${baseClass}--subhead`}>{subtagline}</h4>
|
|
33
|
+
</div>
|
|
34
|
+
{address && (
|
|
35
|
+
<div className="address">
|
|
36
|
+
{address.map((line, i) => (
|
|
37
|
+
<p key={i} className="address--line">
|
|
38
|
+
{line}
|
|
39
|
+
</p>
|
|
40
|
+
))}
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
{linkgroup && (
|
|
44
|
+
<nav className="links">
|
|
45
|
+
<LinkList linkgroup={linkgroup} theme="dark"></LinkList>
|
|
46
|
+
</nav>
|
|
47
|
+
)}
|
|
48
|
+
{(socials || subscribe) && (
|
|
49
|
+
<div className="connect">
|
|
50
|
+
{socials && (
|
|
51
|
+
<>
|
|
52
|
+
<h5 className="social--headline">{socials?.headline}</h5>
|
|
53
|
+
<ul className="social--links">
|
|
54
|
+
{socials.links &&
|
|
55
|
+
socials.links.map((link, index) => (
|
|
56
|
+
<li className="social--links--item" key={index}>
|
|
57
|
+
<a
|
|
58
|
+
className={`social--links--link ${link.type}`}
|
|
59
|
+
href={link.url}
|
|
60
|
+
>
|
|
61
|
+
{link.type}
|
|
62
|
+
</a>
|
|
63
|
+
</li>
|
|
64
|
+
))}
|
|
65
|
+
</ul>
|
|
66
|
+
</>
|
|
67
|
+
)}
|
|
68
|
+
{subscribe && (
|
|
69
|
+
<Button
|
|
70
|
+
label={subscribe?.label}
|
|
71
|
+
url={subscribe?.url}
|
|
72
|
+
type="primary"
|
|
73
|
+
size="large"
|
|
74
|
+
target="_blank"
|
|
75
|
+
></Button>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
<div className={`${baseClass}--secondary`}>
|
|
81
|
+
<div className="legal">{legal}</div>
|
|
82
|
+
{secondarylinks && (
|
|
83
|
+
<nav className="secondarylinks">
|
|
84
|
+
<ul className="secondarylinks--list">
|
|
85
|
+
{secondarylinks.map((link, i) => (
|
|
86
|
+
<li className="secondarylinks--list--item">
|
|
87
|
+
<a
|
|
88
|
+
key={i}
|
|
89
|
+
href={link.url}
|
|
90
|
+
className="secondarylinks--list--link"
|
|
91
|
+
>
|
|
92
|
+
{link?.label}
|
|
93
|
+
</a>
|
|
94
|
+
</li>
|
|
95
|
+
))}
|
|
96
|
+
</ul>
|
|
97
|
+
</nav>
|
|
98
|
+
)}
|
|
99
|
+
<a href={anchorlink?.url} className="anchorlink">
|
|
100
|
+
{anchorlink?.label}
|
|
101
|
+
</a>
|
|
102
|
+
</div>
|
|
103
|
+
</footer>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default Footer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Footer } from "./Footer";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LinkListThemes } from "../../types";
|
|
2
2
|
|
|
3
|
-
interface LinkProps {
|
|
3
|
+
export interface LinkProps {
|
|
4
4
|
/**
|
|
5
5
|
* Specify if this link should indent and have a triangle icon
|
|
6
6
|
*/
|
|
@@ -17,7 +17,7 @@ interface LinkProps {
|
|
|
17
17
|
url?: Required<string>;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
interface LinkGroupProps {
|
|
20
|
+
export interface LinkGroupProps {
|
|
21
21
|
/**
|
|
22
22
|
* Specify an optional headline for this link group
|
|
23
23
|
*/
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { LocalNavProps } from "./LocalNav.props";
|
|
2
|
+
import ilo_logo_white from "@ilo-org/brand-assets/logo_en_horizontal_white.svg";
|
|
3
|
+
|
|
4
|
+
const basic: LocalNavProps = {
|
|
5
|
+
background: "#960A55",
|
|
6
|
+
logo: ilo_logo_white,
|
|
7
|
+
siteurl: "https://www.ilo.org/",
|
|
8
|
+
primarynav: {
|
|
9
|
+
navlabel: "Primary Nav Menu",
|
|
10
|
+
mobilecloselabel: "Close",
|
|
11
|
+
items: [
|
|
12
|
+
{
|
|
13
|
+
label: "Menu Item 1",
|
|
14
|
+
url: "https://www.ilo.org",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: "Menu Item 2",
|
|
18
|
+
url: "https://www.ilo.org",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Menu Item 3",
|
|
22
|
+
url: "https://www.ilo.org",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: "Menu Item 4",
|
|
26
|
+
url: "https://www.ilo.org",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: "Menu Item 5",
|
|
30
|
+
url: "https://www.ilo.org",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
mainlink: {
|
|
35
|
+
label: "Go to main website",
|
|
36
|
+
url: "https://www.ilo.org",
|
|
37
|
+
},
|
|
38
|
+
languagelabel: "English",
|
|
39
|
+
menucloselabel: "Close",
|
|
40
|
+
languagecontextmenu: {
|
|
41
|
+
links: [
|
|
42
|
+
{
|
|
43
|
+
label: "Français",
|
|
44
|
+
url: "https://www.ilo.org",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Español",
|
|
48
|
+
url: "https://www.ilo.org",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "中文",
|
|
52
|
+
url: "https://www.ilo.org",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "Русский",
|
|
56
|
+
url: "https://www.ilo.org",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const LocalNavArgs = { basic };
|
|
63
|
+
|
|
64
|
+
export default LocalNavArgs;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { LinkProps, ContextMenuProps } from "../ContextMenu/ContextMenu.props";
|
|
2
|
+
|
|
3
|
+
export interface LocalNavProps {
|
|
4
|
+
/**
|
|
5
|
+
* Props for the background colour of the LocalNav
|
|
6
|
+
*/
|
|
7
|
+
background?: string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Props for the logo of the LocalNav
|
|
11
|
+
*/
|
|
12
|
+
logo?: Required<string>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Props for the home url of the LocalNav
|
|
16
|
+
*/
|
|
17
|
+
siteurl?: Required<string>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Specify the primary items for the LocalNav
|
|
21
|
+
*/
|
|
22
|
+
primarynav?: Required<PrimaryNavProps>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Specify the main link for the LocalNav
|
|
26
|
+
*/
|
|
27
|
+
mainlink?: LinkProps;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Specify the menu close label for the LocalNav
|
|
31
|
+
*/
|
|
32
|
+
menucloselabel?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Specify the language label for the LocalNav
|
|
36
|
+
*/
|
|
37
|
+
languagelabel?: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Specify the language context menu for the LocalNav
|
|
41
|
+
*/
|
|
42
|
+
languagecontextmenu?: ContextMenuProps;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface PrimaryNavProps {
|
|
46
|
+
/**
|
|
47
|
+
* Specify the label for local nav
|
|
48
|
+
*/
|
|
49
|
+
navlabel?: Required<string>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Specify the close label for mobile local nav
|
|
53
|
+
*/
|
|
54
|
+
mobilecloselabel?: Required<string>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Specify the social links
|
|
58
|
+
*/
|
|
59
|
+
items?: Required<Array<LinkProps>>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { FC, useState } from "react";
|
|
2
|
+
import useGlobalSettings from "../../hooks/useGlobalSettings";
|
|
3
|
+
import { ContextMenu } from "../ContextMenu";
|
|
4
|
+
import { LocalNavProps } from "./LocalNav.props";
|
|
5
|
+
import { brand } from "@ilo-org/themes/tokens/brand/base.json";
|
|
6
|
+
import classnames from "classnames";
|
|
7
|
+
|
|
8
|
+
const LocalNav: FC<LocalNavProps> = ({
|
|
9
|
+
background,
|
|
10
|
+
logo,
|
|
11
|
+
siteurl,
|
|
12
|
+
primarynav,
|
|
13
|
+
mainlink,
|
|
14
|
+
menucloselabel,
|
|
15
|
+
languagelabel,
|
|
16
|
+
languagecontextmenu,
|
|
17
|
+
}) => {
|
|
18
|
+
const { prefix } = useGlobalSettings();
|
|
19
|
+
|
|
20
|
+
const [toggleMenuOpen, setMenuToggleOpen] = useState(false);
|
|
21
|
+
const [toggleLanguageOpen, setLanguageToggleOpen] = useState(false);
|
|
22
|
+
|
|
23
|
+
const baseClass = `${prefix}--header`;
|
|
24
|
+
const localNavClasses = classnames(baseClass, `${baseClass}--local`, {
|
|
25
|
+
[`${prefix}--mobile--open`]: toggleMenuOpen,
|
|
26
|
+
[`${prefix}--select--open`]: toggleLanguageOpen,
|
|
27
|
+
});
|
|
28
|
+
const bg = background ? background : brand["ilo-dark-blue"].value;
|
|
29
|
+
|
|
30
|
+
const handleMenuToggle = () => {
|
|
31
|
+
setMenuToggleOpen(!toggleMenuOpen);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleLanguageToggle = () => {
|
|
35
|
+
setLanguageToggleOpen(!toggleLanguageOpen);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<header className={localNavClasses}>
|
|
40
|
+
<div
|
|
41
|
+
className={`${baseClass}--utility-bar ${baseClass}--utility-bar--local`}
|
|
42
|
+
style={{ background: bg }}
|
|
43
|
+
>
|
|
44
|
+
<nav className={`${prefix}--nav--local`}>
|
|
45
|
+
<div className={`${prefix}--nav--local--logo-wrapper`}>
|
|
46
|
+
<a href={siteurl} className={`${prefix}--nav--local--logo-link`}>
|
|
47
|
+
<img
|
|
48
|
+
src={logo}
|
|
49
|
+
alt="ILO Logo"
|
|
50
|
+
className={`${prefix}--nav--local--logo`}
|
|
51
|
+
/>
|
|
52
|
+
</a>
|
|
53
|
+
</div>
|
|
54
|
+
<ul className={`${prefix}--nav--local--set`}>
|
|
55
|
+
{primarynav?.items &&
|
|
56
|
+
primarynav.items.map((item, index) => (
|
|
57
|
+
<li className={`${prefix}--nav--local--item`} key={index}>
|
|
58
|
+
<a href={item.url} className={`${prefix}--nav--local--link`}>
|
|
59
|
+
<span>{item.label}</span>
|
|
60
|
+
</a>
|
|
61
|
+
</li>
|
|
62
|
+
))}
|
|
63
|
+
</ul>
|
|
64
|
+
</nav>
|
|
65
|
+
<div className={`${prefix}--language-switcher`}>
|
|
66
|
+
<div className={`${prefix}--language-switcher--wrap`}>
|
|
67
|
+
{mainlink && (
|
|
68
|
+
<span className={`${prefix}--language-switcher--link--wrap`}>
|
|
69
|
+
<a
|
|
70
|
+
href={mainlink.url}
|
|
71
|
+
className={`${prefix}--language-switcher--link`}
|
|
72
|
+
>
|
|
73
|
+
{mainlink.label}
|
|
74
|
+
</a>
|
|
75
|
+
</span>
|
|
76
|
+
)}
|
|
77
|
+
<button
|
|
78
|
+
className={`${prefix}--language-switcher--button`}
|
|
79
|
+
type="button"
|
|
80
|
+
>
|
|
81
|
+
{languagelabel}
|
|
82
|
+
</button>
|
|
83
|
+
<ContextMenu links={languagecontextmenu?.links}></ContextMenu>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<button className={`${baseClass}--menu`} onClick={handleMenuToggle}>
|
|
87
|
+
Menu
|
|
88
|
+
</button>
|
|
89
|
+
<div className={`${baseClass}--navigation`}>
|
|
90
|
+
<div className={`${baseClass}--inner`}>
|
|
91
|
+
<div className={`${prefix}--mobile--nav`}>
|
|
92
|
+
<div className={`${prefix}--mobile--nav--logo`}>
|
|
93
|
+
<a href={siteurl} className={`${baseClass}--logo-link`}>
|
|
94
|
+
<img
|
|
95
|
+
className={`${baseClass}--logo`}
|
|
96
|
+
src={logo}
|
|
97
|
+
alt="ILO Logo"
|
|
98
|
+
/>
|
|
99
|
+
</a>
|
|
100
|
+
<button
|
|
101
|
+
className={`${baseClass}--menu--close`}
|
|
102
|
+
onClick={handleMenuToggle}
|
|
103
|
+
>
|
|
104
|
+
{menucloselabel}
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
<div className={`${prefix}--mobile--nav--language--switcher`}>
|
|
108
|
+
<button
|
|
109
|
+
className={`${prefix}--mobile--nav--language--switcher--button`}
|
|
110
|
+
onClick={handleLanguageToggle}
|
|
111
|
+
type="button"
|
|
112
|
+
>
|
|
113
|
+
{languagelabel}
|
|
114
|
+
</button>
|
|
115
|
+
</div>
|
|
116
|
+
<div className={`${prefix}--mobile--nav--language--select`}>
|
|
117
|
+
<div className={`${baseClass}--inner`}>
|
|
118
|
+
<div className={`${prefix}--mobile--subnav--menu`}>
|
|
119
|
+
<button
|
|
120
|
+
className={`${prefix}--mobile--subnav--back`}
|
|
121
|
+
onClick={handleLanguageToggle}
|
|
122
|
+
type="button"
|
|
123
|
+
></button>
|
|
124
|
+
<button
|
|
125
|
+
className={`${baseClass}--menu--close`}
|
|
126
|
+
onClick={handleMenuToggle}
|
|
127
|
+
>
|
|
128
|
+
Close
|
|
129
|
+
</button>
|
|
130
|
+
<h6 className={`${prefix}--mobile--subnav--label`}>
|
|
131
|
+
{languagelabel}
|
|
132
|
+
</h6>
|
|
133
|
+
</div>
|
|
134
|
+
<ul className={`${prefix}--nav--set`}>
|
|
135
|
+
{languagecontextmenu?.links &&
|
|
136
|
+
languagecontextmenu.links.map((item, index) => (
|
|
137
|
+
<li className={`${prefix}--nav--items`} key={index}>
|
|
138
|
+
<a
|
|
139
|
+
href={item.url}
|
|
140
|
+
className={`${prefix}--nav--link ${prefix}--nav--language`}
|
|
141
|
+
>
|
|
142
|
+
{item.label}
|
|
143
|
+
</a>
|
|
144
|
+
</li>
|
|
145
|
+
))}
|
|
146
|
+
</ul>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
<nav
|
|
151
|
+
className={`${prefix}--nav`}
|
|
152
|
+
aria-labelledby="primary-navigation"
|
|
153
|
+
>
|
|
154
|
+
<h2 className={`${prefix}--nav--label`} id="primary-navigation">
|
|
155
|
+
{primarynav?.navlabel}
|
|
156
|
+
</h2>
|
|
157
|
+
<ul className={`${prefix}--nav--set`}>
|
|
158
|
+
{primarynav?.items &&
|
|
159
|
+
primarynav.items.map((item, index) => (
|
|
160
|
+
<li className={`${prefix}--nav--items`} key={index}>
|
|
161
|
+
<a href={item.url} className={`${prefix}--nav--link`}>
|
|
162
|
+
{item.label}
|
|
163
|
+
</a>
|
|
164
|
+
</li>
|
|
165
|
+
))}
|
|
166
|
+
</ul>
|
|
167
|
+
</nav>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</header>
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export default LocalNav;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LocalNav } from "./LocalNav";
|
package/src/components/index.ts
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -48,3 +48,4 @@ export type NotificationTypes = "error" | "info" | "success" | "warning";
|
|
|
48
48
|
export type PositionTypes = "top" | "bottom" | "left" | "right";
|
|
49
49
|
export type SizeTypes = "small" | "medium" | "large";
|
|
50
50
|
export type TagTypes = "anchor" | "display" | "button";
|
|
51
|
+
export type SocialTypes = "instagram" | "facebook" | "twitter" | "youtube";
|