Skip to content

Commit

Permalink
feat: footer icons
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Jun 19, 2024
1 parent 8bdc341 commit 463696b
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
24 changes: 24 additions & 0 deletions config/social-links.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
7 changes: 7 additions & 0 deletions src/theme/Footer/Copyright/index.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
.wrap {
display: flex;
justify-content: space-between;
}

span.icon {
width: 15px;
height: 15px;
margin: 0 10px;
padding: 3px;
}
18 changes: 17 additions & 1 deletion src/theme/Footer/Copyright/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof CopyrightType>;

Expand All @@ -11,7 +12,22 @@ export default function CopyrightWrapper(props: Props): JSX.Element {
<>
<div className={styles.wrap}>
<Copyright {...props} />
social
<div>
{socialLinks.links.map((i, key) => (
<a
key={key}
href={i.href}
target="_blank"
rel="noopener noreferrer"
>
{i.icon ? (
<img src={i.icon} />
) : (
<span className={styles.icon}>?</span>
)}
</a>
))}
</div>
</div>
</>
);
Expand Down
12 changes: 12 additions & 0 deletions static/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit 463696b

Please sign in to comment.