From 463696b1072b1011ff30b61aa054773bca3bd55f Mon Sep 17 00:00:00 2001 From: "yongen.loong" Date: Wed, 19 Jun 2024 12:29:41 +0800 Subject: [PATCH] feat: footer icons --- config/social-links.json | 24 +++++++++++++++++++++ src/theme/Footer/Copyright/index.module.css | 7 ++++++ src/theme/Footer/Copyright/index.tsx | 18 +++++++++++++++- static/admin/config.yml | 12 +++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 config/social-links.json diff --git a/config/social-links.json b/config/social-links.json new file mode 100644 index 00000000..0afa08c3 --- /dev/null +++ b/config/social-links.json @@ -0,0 +1,24 @@ +{ + "links": [ + { + "label": "Twitter", + "icon": "", + "href": "https://twitter.com/aelfblockchain" + }, + { + "label": "Discord", + "icon": "", + "href": "https://discord.gg/bgysa9xjvD" + }, + { + "label": "Medium", + "icon": "", + "href": "https://medium.com/aelfblockchain" + }, + { + "label": "GitHub", + "icon": "", + "href": "https://github.com/AElfProject" + } + ] +} diff --git a/src/theme/Footer/Copyright/index.module.css b/src/theme/Footer/Copyright/index.module.css index cc9d5415..cf6c45d8 100644 --- a/src/theme/Footer/Copyright/index.module.css +++ b/src/theme/Footer/Copyright/index.module.css @@ -1,4 +1,11 @@ .wrap { display: flex; justify-content: space-between; +} + +span.icon { + width: 15px; + height: 15px; + margin: 0 10px; + padding: 3px; } \ No newline at end of file diff --git a/src/theme/Footer/Copyright/index.tsx b/src/theme/Footer/Copyright/index.tsx index 872aa246..12eda3fa 100644 --- a/src/theme/Footer/Copyright/index.tsx +++ b/src/theme/Footer/Copyright/index.tsx @@ -3,6 +3,7 @@ import Copyright from "@theme-original/Footer/Copyright"; import type CopyrightType from "@theme/Footer/Copyright"; import type { WrapperProps } from "@docusaurus/types"; import styles from "./index.module.css"; +import socialLinks from "../../../../config/social-links.json"; type Props = WrapperProps; @@ -11,7 +12,22 @@ export default function CopyrightWrapper(props: Props): JSX.Element { <>
- social +
+ {socialLinks.links.map((i, key) => ( + + {i.icon ? ( + + ) : ( + ? + )} + + ))} +
); diff --git a/static/admin/config.yml b/static/admin/config.yml index cb1b5408..afb960f4 100644 --- a/static/admin/config.yml +++ b/static/admin/config.yml @@ -70,3 +70,15 @@ collections: - {label: Label, name: label, widget: string} - {label: To, name: to, widget: string, required: false} - {label: Href, name: href, widget: string, required: false} + - label: "Social Links" + name: "sociallinks" + file: "config/social-links.json" + fields: + - label: Links + name: links + widget: list + collapsed: false + fields: + - {label: Label, name: label, widget: string} + - {label: Href, name: href, widget: string} + - {label: Icon, name: icon, widget: image, allow_multiple: false, required: false} \ No newline at end of file