Skip to content

Commit

Permalink
Merge pull request #112 from jermspeaks/bug/relative-link-fix-1
Browse files Browse the repository at this point in the history
Fix the relative links by removing on mobile and making classes for c…
  • Loading branch information
jermspeaks authored Jun 6, 2023
2 parents fb26fa3 + 8041fb6 commit 71e7127
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
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>

0 comments on commit 71e7127

Please sign in to comment.