-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFooter.tsx
More file actions
executable file
·205 lines (194 loc) · 7.63 KB
/
Footer.tsx
File metadata and controls
executable file
·205 lines (194 loc) · 7.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import React from "react";
import { FooterProps } from "./Footer.types";
import { LinkWithRef } from "../LinkWithRef";
const Footer: React.FC<FooterProps> = (props) => {
const {
className,
containerClassName,
meta,
navigation,
contentLicence,
...attributes
} = props;
let navigationComponent: React.ReactNode;
let metaComponent: React.ReactNode;
let contentLicenceComponent: React.ReactNode;
if (navigation && navigation.length > 0) {
navigationComponent = (
<>
<div className="govuk-footer__navigation">
{navigation.map((nav, navIndex) => (
<div
className={`govuk-footer__section govuk-grid-column-${nav.width ? nav.width : "full"}`}
key={nav.reactListKey || navIndex}
>
<h2 className="govuk-footer__heading govuk-heading-m">
{nav.title}
</h2>
{nav.items && nav.items.length > 0 ? (
<ul
className={`govuk-footer__list ${nav.columns ? `govuk-footer__list--columns-${nav.columns}` : ""}`}
>
{nav.items.map((item, index) => {
const {
className: itemClassName,
children: itemChildren,
reactListKey,
...itemAttributes
} = item;
return (
<React.Fragment key={reactListKey || index}>
{(item.href || item.to) && itemChildren && (
<li className="govuk-footer__list-item">
<LinkWithRef
className={`govuk-footer__link ${itemClassName || ""}`}
{...itemAttributes}
>
{itemChildren}
</LinkWithRef>
</li>
)}
</React.Fragment>
);
})}
</ul>
) : null}
</div>
))}
</div>
<hr className="govuk-footer__section-break" />
</>
);
}
if (meta) {
metaComponent = (
<>
<h2 className="govuk-visually-hidden">
{meta.visuallyHiddenTitle
? meta.visuallyHiddenTitle
: "Support links"}
</h2>
{meta.items && meta.items.length > 0 ? (
<ul className="govuk-footer__inline-list">
{meta.items.map((item, index) => {
const {
className: itemClassName,
children: itemChildren,
reactListKey,
...itemAttributes
} = item;
return (
<li
className="govuk-footer__inline-list-item"
key={reactListKey || index}
>
<LinkWithRef
className={`govuk-footer__link ${itemClassName || ""}`}
{...itemAttributes}
>
{itemChildren}
</LinkWithRef>
</li>
);
})}
</ul>
) : null}
{meta.children ? (
<div className="govuk-footer__meta-custom">{meta.children}</div>
) : null}
</>
);
}
if (contentLicence) {
const {
className: contentLicenceClassName,
children: contentLicenceChildren,
...contentLicenceAttributes
} = contentLicence;
contentLicenceComponent = (
<div className={contentLicenceClassName} {...contentLicenceAttributes}>
{contentLicenceChildren}
</div>
);
} else if (contentLicence === undefined) {
contentLicenceComponent = (
<>
<svg
aria-hidden="true"
focusable="false"
className="govuk-footer__licence-logo"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 483.2 195.7"
height="17"
width="41"
>
<path
fill="currentColor"
d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"
/>
</svg>
<span className="govuk-footer__licence-description">
All content is available under the
<a
className="govuk-footer__link"
href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
rel="license"
>
Open Government Licence v3.0
</a>
, except where otherwise stated
</span>
</>
);
} else {
contentLicenceComponent = <></>;
}
return (
<footer
className={`govuk-footer ${className || ""}`}
role="contentinfo"
{...attributes}
>
<div className={`govuk-width-container ${containerClassName || ""}`}>
<svg
focusable="false"
role="presentation"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 64 60"
height="30"
width="32"
fill="currentcolor"
className="govuk-footer__crown"
>
<g>
<circle cx="20" cy="17.6" r="3.7" />
<circle cx="10.2" cy="23.5" r="3.7" />
<circle cx="3.7" cy="33.2" r="3.7" />
<circle cx="31.7" cy="30.6" r="3.7" />
<circle cx="43.3" cy="17.6" r="3.7" />
<circle cx="53.2" cy="23.5" r="3.7" />
<circle cx="59.7" cy="33.2" r="3.7" />
<circle cx="31.7" cy="30.6" r="3.7" />
<path d="M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z" />
</g>
</svg>
{navigationComponent}
<div className="govuk-footer__meta">
<div className="govuk-footer__meta-item govuk-footer__meta-item--grow">
{metaComponent}
{contentLicenceComponent}
</div>
<div className="govuk-footer__meta-item">
<a
className="govuk-footer__link govuk-footer__copyright-logo"
href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/"
>
© Crown copyright
</a>
</div>
</div>
</div>
</footer>
);
};
export default Footer;