Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the relative links by removing on mobile and making classes for c… #112

Merged
merged 2 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ export default defineConfig({
content: {
type: "element",
tagName: "span",
properties: { className: ["relative"] },
properties: { className: ["heading-link"] },
children: [
{
type: "element",
tagName: "svg",
properties: {
className: ["absolute top-0 -left-16"],
style: "top: 0.8rem; left: -2.4rem;",
width: 24,
height: 24,
version: 1.1,
Expand All @@ -48,16 +46,6 @@ export default defineConfig({
},
],
},
// {
// type: "element",
// tagName: "img",
// properties: {
// src: "/images/heading-link.svg",
// alt: "Link icon",
// className: ["m-0", "h-4", "w-4"],
// },
// children: [],
// },
],
},
},
Expand All @@ -72,11 +60,10 @@ export default defineConfig({
src: "/images/external-link.svg",
alt: "External link icon",
width: "16",
className: "inline-block ml-2 align-super",
},
children: [],
},
contentProperties: { className: ["external-link "] },
contentProperties: { className: ["external-link"] },
},
],
],
Expand Down
20 changes: 19 additions & 1 deletion src/components/ProseArticle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,27 @@ const { class: className } = Astro.props;

<article
class:list={[
"prose lg:prose-xl dark:prose-invert prose-img:mt-0 prose-img:mb-0 mx-auto",
"prose lg:prose-xl dark:prose-invert prose-img:mt-0 prose-img:mb-0 hover:prose-a:text-amber-600 mx-auto",
className,
]}
>
<slot />
</article>
<style lang="css" is:global>
h2:hover .heading-link,
h3:hover .heading-link,
h4:hover .heading-link,
h5:hover .heading-link {
@apply opacity-100;
}
.heading-link {
@apply hidden md:inline md:opacity-0 relative;
}
.heading-link svg {
@apply absolute top-1/2 -translate-y-1/2 -left-7;
}

.external-link {
@apply inline-block align-super;
}
</style>