Skip to content

Commit

Permalink
feat: mobile footer
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Aug 27, 2024
1 parent 29e65cb commit 387b2f6
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 37 deletions.
2 changes: 1 addition & 1 deletion config/footer-links.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
]
},
{
"title": "Developer Resources",
"title": "Developer",
"items": [
{
"label": "Quick Start",
Expand Down
10 changes: 10 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,14 @@
.mobile-hidden {
display: none;
}

.col.footer__col {
--ifm-col-width: 50%;
}
}

@media screen and (min-width: 996px) {
.mobile-only {
display: none;
}
}
18 changes: 0 additions & 18 deletions src/theme/Footer/Copyright/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@
justify-content: space-between;
}

span.icon {
width: 15px;
height: 15px;
margin: 0 10px;
padding: 3px;
}

.img {
margin: 0 0 0 10px;
}

.logo {
display: none;
}
Expand All @@ -24,13 +13,6 @@ span.icon {
text-align: left;
}

.social {
order: -1;
padding-bottom: 0.5rem;
margin-bottom: 1rem;
border-bottom: 1px solid #ccc;
}

.logo {
display: block;
width: 4rem;
Expand Down
22 changes: 4 additions & 18 deletions src/theme/Footer/Copyright/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,24 @@ 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 "@site/config/social-links.json";
import Logo from "@site/src/theme/logo";
import Social from "../Social";

type Props = WrapperProps<typeof CopyrightType>;

export default function CopyrightWrapper(props: Props): JSX.Element {
return (
<>
<div className={styles.wrap}>
<div className="mobile-hidden">
<Social />
</div>
<div className={styles.copyright}>
<div className={styles.logo}>
<Logo />
</div>
<Copyright {...props} />
</div>
<div className={styles.social}>
{socialLinks.links.map((i, key) => (
<a
key={key}
href={i.href}
target="_blank"
rel="noopener noreferrer"
title={i.label}
>
{i.icon ? (
<img src={i.icon} className={styles.img} />
) : (
<span className={styles.icon}>?</span>
)}
</a>
))}
</div>
</div>
</>
);
Expand Down
6 changes: 6 additions & 0 deletions src/theme/Footer/Links/MultiColumn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import LinkItem from "@theme/Footer/LinkItem";
import type { Props } from "@theme/Footer/Links/MultiColumn";
import Logo from "@site/src/theme/logo";
import Social from "../../Social";

type ColumnType = Props["columns"][number];
type ColumnItemType = ColumnType["items"][number];
Expand Down Expand Up @@ -30,6 +31,11 @@ function Column({ column }: { column: ColumnType }) {
<ColumnLinkItem key={i} item={item} />
))}
</ul>
{column.title === "Connect" ? (
<div className="mobile-only" style={{ marginTop: 10, marginLeft: -10 }}>
<Social />
</div>
) : null}
</div>
);
}
Expand Down
17 changes: 17 additions & 0 deletions src/theme/Footer/Social/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
span.icon {
width: 15px;
height: 15px;
margin: 0 10px;
padding: 3px;
}

.img {
margin: 0 0 0 10px;
}

@media screen and (max-width: 996px) {
.social {
order: -1;
padding-bottom: 0.5rem;
}
}
25 changes: 25 additions & 0 deletions src/theme/Footer/Social/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from "react";
import styles from "./index.module.css";
import socialLinks from "@site/config/social-links.json";

export default function Social(): JSX.Element {
return (
<div className={styles.social}>
{socialLinks.links.map((i, key) => (
<a
key={key}
href={i.href}
target="_blank"
rel="noopener noreferrer"
title={i.label}
>
{i.icon ? (
<img src={i.icon} className={styles.img} />
) : (
<span className={styles.icon}>?</span>
)}
</a>
))}
</div>
);
}

0 comments on commit 387b2f6

Please sign in to comment.