added a custom footer?

This commit is contained in:
Ulysia 2024-10-14 08:21:45 +02:00
parent be453f9d74
commit ecaac79943
2 changed files with 12 additions and 12 deletions

View file

@ -1,7 +1,6 @@
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import style from "./styles/footer.scss" import style from "./styles/footer.scss"
import { version } from "../../package.json" import FooterLinksConstructor from "./Footer_links"
import { i18n } from "../i18n"
interface Options { interface Options {
links: Record<string, string> links: Record<string, string>
@ -9,17 +8,16 @@ interface Options {
} }
export default ((opts?: Options) => { export default ((opts?: Options) => {
const Footer: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { const FooterLinks = FooterLinksConstructor(opts)
const year = new Date().getFullYear()
const links = opts?.links ?? [] const CustomFooter: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
const rings = opts?.rings ?? []
return ( return (
<footer class={`${displayClass ?? ""}`}> <footer class={`${displayClass ?? ""}`}>
Component.Footer_links(links, rings) <FooterLinks displayClass={displayClass} cfg={cfg} />
</footer> </footer>
) )
} }
Footer.css = style CustomFooter.css = style
return Footer return CustomFooter
}) satisfies QuartzComponentConstructor }) satisfies QuartzComponentConstructor

View file

@ -9,11 +9,12 @@ interface Options {
} }
export default ((opts?: Options) => { export default ((opts?: Options) => {
const Footer: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { const FooterLinks: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
const year = new Date().getFullYear() const year = new Date().getFullYear()
const links = opts?.links ?? [] const links = opts?.links ?? []
const rings = opts?.rings ?? [] const rings = opts?.rings ?? []
return ( return (
<div>
<hr /> <hr />
<ul> <ul>
{Object.entries(links).map(([text, link]) => ( {Object.entries(links).map(([text, link]) => (
@ -40,9 +41,10 @@ export default ((opts?: Options) => {
</div> </div>
))} ))}
</div> </div>
</div>
) )
} }
Footer.css = style FooterLinks.css = style
return Footer return FooterLinks
}) satisfies QuartzComponentConstructor }) satisfies QuartzComponentConstructor