Skip to content

Commit

Permalink
fix footer
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Nov 5, 2024
1 parent e5d10f5 commit fb3b136
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 163 deletions.
218 changes: 109 additions & 109 deletions src/default-theme/components/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,113 +12,113 @@ import { useSolidBaseContext } from "../utils";
import styles from "./Article.module.css";

export default function Article(props: ParentProps) {
const { config } = useSolidBaseContext();

const { TableOfContents, Link, LastUpdated, Footer } = useThemeComponents();

const [contentRef, setContentRef] = createSignal<HTMLElement>();

const [clickedCodeElement, setClickedCodeElement] =
createSignal<HTMLElement>();

const pageData = useCurrentPageData();

createShortcut(
[isAppleDevice ? "Meta" : "Control", "A"],
(event) => {
// Only handle when code last clicked and no focus or copy button focused
if (
(clickedCodeElement() && document.activeElement === document.body) ||
(event?.target as HTMLElement | undefined)?.closest(
"div.expressive-code",
)
) {
const targetNode =
(event?.target as HTMLElement | undefined)?.closest(
"div.expressive-code",
) ?? clickedCodeElement()!;

if (window.getSelection()?.anchorNode === contentRef()) {
return; // Code already selected, select all (default) instead.
}

const range = document.createRange();
range.selectNode(targetNode);
window.getSelection()?.removeAllRanges();
window.getSelection()?.addRange(range);
event?.preventDefault();
}
},
{ preventDefault: false },
);

const onClick = (event: MouseEvent) => {
if (event.target) {
const closestCode = (event.target as HTMLElement).closest(
"div.expressive-code",
);
setClickedCodeElement(
(closestCode ?? undefined) as HTMLElement | undefined,
);
}
};

const prevNext = usePrevNext();

return (
<>
<WindowEventListener onClick={onClick} />

<article class={styles.article}>
<div ref={setContentRef} class={styles.content}>
{props.children}

<div class={styles.info}>
<Show when={pageData().editLink}>
<Link href={pageData().editLink}>Edit this page on GitHub</Link>
</Show>

<Show when={pageData().lastUpdated}>
<LastUpdated />
</Show>
</div>

<Show when={prevNext.prevLink() || prevNext.nextLink()}>
<nav class={styles.related}>
<div>
<Show when={prevNext.prevLink()}>
{(link) => (
<a class={styles.prev} href={link().link}>
<span>Previous</span>
{link().title}
</a>
)}
</Show>
</div>
<div>
<Show when={prevNext.nextLink()}>
{(link) => (
<a class={styles.next} href={link().link}>
<span>Next</span>
{link().title}
</a>
)}
</Show>
</div>
</nav>
</Show>

<Show when={config().themeConfig?.footer}>
<Footer />
</Show>
</div>

<Show when={!mobileLayout()}>
<aside class={styles.aside}>
<TableOfContents />
</aside>
</Show>
</article>
</>
);
const { config } = useSolidBaseContext();

const { TableOfContents, Link, LastUpdated, Footer } = useThemeComponents();

const [contentRef, setContentRef] = createSignal<HTMLElement>();

const [clickedCodeElement, setClickedCodeElement] =
createSignal<HTMLElement>();

const pageData = useCurrentPageData();

createShortcut(
[isAppleDevice ? "Meta" : "Control", "A"],
(event) => {
// Only handle when code last clicked and no focus or copy button focused
if (
(clickedCodeElement() && document.activeElement === document.body) ||
(event?.target as HTMLElement | undefined)?.closest(
"div.expressive-code",
)
) {
const targetNode =
(event?.target as HTMLElement | undefined)?.closest(
"div.expressive-code",
) ?? clickedCodeElement()!;

if (window.getSelection()?.anchorNode === contentRef()) {
return; // Code already selected, select all (default) instead.
}

const range = document.createRange();
range.selectNode(targetNode);
window.getSelection()?.removeAllRanges();
window.getSelection()?.addRange(range);
event?.preventDefault();
}
},
{ preventDefault: false },
);

const onClick = (event: MouseEvent) => {
if (event.target) {
const closestCode = (event.target as HTMLElement).closest(
"div.expressive-code",
);
setClickedCodeElement(
(closestCode ?? undefined) as HTMLElement | undefined,
);
}
};

const prevNext = usePrevNext();

return (
<>
<WindowEventListener onClick={onClick} />

<article class={styles.article}>
<div ref={setContentRef} class={styles.content}>
{props.children}

<div class={styles.info}>
<Show when={pageData().editLink}>
<Link href={pageData().editLink}>Edit this page on GitHub</Link>
</Show>

<Show when={pageData().lastUpdated}>
<LastUpdated />
</Show>
</div>

<Show when={prevNext.prevLink() || prevNext.nextLink()}>
<nav class={styles.related}>
<div>
<Show when={prevNext.prevLink()}>
{(link) => (
<a class={styles.prev} href={link().link}>
<span>Previous</span>
{link().title}
</a>
)}
</Show>
</div>
<div>
<Show when={prevNext.nextLink()}>
{(link) => (
<a class={styles.next} href={link().link}>
<span>Next</span>
{link().title}
</a>
)}
</Show>
</div>
</nav>
</Show>

<Show when={config().themeConfig?.footer ?? true}>
<Footer />
</Show>
</div>

<Show when={!mobileLayout()}>
<aside class={styles.aside}>
<TableOfContents />
</aside>
</Show>
</article>
</>
);
}
110 changes: 56 additions & 54 deletions src/default-theme/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,70 +6,72 @@ import type { SocialLink } from "..";
import { useRouteConfig } from "../utils";

const logos: Partial<Record<SocialLink["type"], string>> = {
discord:
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjcuMTQgOTYuMzYiPjxwYXRoIGZpbGw9ImN1cnJlbnRDb2xvciIgZD0iTTEwNy43LDguMDdBMTA1LjE1LDEwNS4xNSwwLDAsMCw4MS40NywwYTcyLjA2LDcyLjA2LDAsMCwwLTMuMzYsNi44M0E5Ny42OCw5Ny42OCwwLDAsMCw0OSw2LjgzLDcyLjM3LDcyLjM3LDAsMCwwLDQ1LjY0LDAsMTA1Ljg5LDEwNS44OSwwLDAsMCwxOS4zOSw4LjA5QzIuNzksMzIuNjUtMS43MSw1Ni42LjU0LDgwLjIxaDBBMTA1LjczLDEwNS43MywwLDAsMCwzMi43MSw5Ni4zNiw3Ny43LDc3LjcsMCwwLDAsMzkuNiw4NS4yNWE2OC40Miw2OC40MiwwLDAsMS0xMC44NS01LjE4Yy45MS0uNjYsMS44LTEuMzQsMi42Ni0yYTc1LjU3LDc1LjU3LDAsMCwwLDY0LjMyLDBjLjg3LjcxLDEuNzYsMS4zOSwyLjY2LDJhNjguNjgsNjguNjgsMCwwLDEtMTAuODcsNS4xOSw3Nyw3NywwLDAsMCw2Ljg5LDExLjFBMTA1LjI1LDEwNS4yNSwwLDAsM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MzAuNjY0MTc0MiAyNC44OTk0NTMzLDI5LjY5NzY3NzkgTDI5LjgyMTE5OTksMzQuNjE5NDI0NSBDMjYuNzUwNDczNCwzNi43NTA4NDg5IDIzLjAyMTExNDEsMzggMTksMzggQzguNTA2NTg5NzUsMzggMCwyOS40OTM0MTAyIDAsMTkgQzAsOC41MDY1ODk3NSA4LjUwNjU4OTc1LDAgMTksMCBDMjMuMDIxMTE0MSwwIDI2Ljc1MDQ3MzQsMS4yNDkxNTExMiAyOS44MjExOTk5LDMuMzgwNTc1NTIgWiIgaWQ9IkNvbWJpbmVkLVNoYXBlLUNvcHktMiIgZmlsbD0iY3VycmVudENvbG9yIj48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMzQuNjE5NDI0NSw4LjE3ODgwMDExIEMzNi43NTA4NDg5LDExLjI0OTUyNjYgMzgsMTQuOTc4ODg1OSAzOCwxOSBDMzgsMjMuMDIxMTE0MSAzNi43NTA4NDg5LDI2Ljc1MDQ3MzQgMzQuNjE5NDI0NSwyOS44MjExOTk5IEwyOS42OTc2Nzc5LDI0Ljg5OTQ1MzMgQzMwLjY2NDE3NDIsMjMuMTUwNjA1MyAzMS4yMTQyODU3LDIxLjEzOTU0NTQgMzEuMjE0Mjg1NywxOSBDMzEuMjE0Mjg1NywxNi44NjA0NTQ2IDMwLjY2NDE3NDIsMTQuODQ5Mzk0NyAyOS42OTc2Nzc5LDEzLjEwMDU0NjcgTDM0LjYxOTQyNDUsOC4xNzg4MDAxMSBaIiBpZD0iY2xvc2luZy1vIiBmaWxsPSJjdXJyZW50Q29sb3IiPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAKICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==",
};

export default function Footer() {
const config = useRouteConfig();
const config = useRouteConfig();

return (
<footer class={styles.footer}>
<div>
<Show when={config().logo} fallback={<span>{config().title}</span>}>
<img src={config().logo} alt={config().title} />
</Show>
{config().description}
</div>
return (
<footer class={styles.footer}>
<div>
<Show when={config().logo} fallback={<span>{config().title}</span>}>
<img src={config().logo} alt={config().title} />
</Show>
{config().description}
</div>

<Show when={config().themeConfig?.socialLinks}>
{(links) => (
<div>
<span>Community</span>
<div class={styles.socials}>
<For each={Object.keys(links())}>
{(social) => {
const preset = Object.hasOwn(logos, social);
<Show when={config().themeConfig?.socialLinks}>
{(links) => (
<div>
<span>Community</span>
<div class={styles.socials}>
<For each={Object.keys(links())}>
{(social) => {
const preset = Object.hasOwn(logos, social);

const data = (): SocialLink => {
const data = preset
? {
type: social as SocialLink["type"],
// @ts-ignore
link: config().socialLinks[social],
}
: // @ts-ignore
config().socialLinks[social];
const data = (): SocialLink | undefined => {
const link = (links() as any)[social];
if (!link) return;

if (!preset) data.type = "custom";
const data = preset
? { type: social as SocialLink["type"], link }
: link;

return data;
};
if (!preset) data.type = "custom";

return <SocialLinkView {...data()} />;
}}
</For>
</div>
</div>
)}
</Show>
</footer>
);
return data;
};

return (
<Show when={data()}>
{(data) => <SocialLinkView {...data()} />}
</Show>
);
}}
</For>
</div>
</div>
)}
</Show>
</footer>
);
}

function SocialLinkView(props: SocialLink) {
return (
<a href={props.link} target="_blank" rel="noreferrer noopener">
<Show
when={props.type !== "custom"}
fallback={<img alt={props.label} src={props.logo} />}
>
<img alt={props.type} src={logos[props.type as keyof typeof logos]} />
</Show>
</a>
);
return (
<a href={props.link} target="_blank" rel="noreferrer noopener">
<Show
when={props.type !== "custom"}
fallback={<img alt={props.label} src={props.logo} />}
>
<img alt={props.type} src={logos[props.type as keyof typeof logos]} />
</Show>
</a>
);
}

0 comments on commit fb3b136

Please sign in to comment.