-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFooter.js
More file actions
38 lines (34 loc) · 1.47 KB
/
Footer.js
File metadata and controls
38 lines (34 loc) · 1.47 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
import importedStyles from "./Footer.module.css";
export default function Footer(props) {
const copyrightHolder = props.copyrightHolder;
const items = props.items;
const linkFactory = props.linkFactory || defaultLinkFactory;
const styles = props.styles || importedStyles;
const theme = props.theme;
const title = props.title;
const year = new Date().getFullYear();
function defaultLinkFactory(href, target, children) {
return (
<a href={href} target={target}>
{children}
</a>
);
}
return (
<footer className={styles.footer + (theme === "danger" ? " " + styles.footer_danger : "") + (theme === "dark" ? " " + styles.footer_dark : "") + (theme === "primary" ? " " + styles.footer_primary : "") + (theme === "secondary" ? " " + styles.footer_secondary : "") + (theme === "success" ? " " + styles.footer_success : "")} style={{ "--src-footer-columns": items.length || 1 }}>
{title && <div className={styles.title}>{title}</div>}
<div className={styles.content}>
{items.map((item, itemIndex) => (
<ul key={"item-" + itemIndex}>
{item.items.map((subItem, subItemIndex) => (
<li key={"item-" + itemIndex + "-sub-item-" + subItemIndex}>{subItem.href ? linkFactory(subItem.href, subItem.target, subItem.text) : subItem.text}</li>
))}
</ul>
))}
</div>
<div className={styles.copyright}>
© {copyrightHolder} {year}
</div>
</footer>
);
}