Skip to content

Commit

Permalink
👈 Disable hover modifier for mobile in HashLink (#516)
Browse files Browse the repository at this point in the history
* fix: disable hover modifier for mobile

* chore: add changeset

* fix: only forcibly-show footnote links on mobile
  • Loading branch information
agoose77 authored Jan 14, 2025
1 parent 1f873f8 commit a4350b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-geese-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-to-react': patch
---

Always show hover HashLink on mobile
6 changes: 4 additions & 2 deletions packages/myst-to-react/src/hashLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function HashLink({
id?: string;
kind?: string;
title?: string;
hover?: boolean;
hover?: boolean | 'desktop';
children?: '#' | '¶' | React.ReactNode;
canSelectText?: boolean;
className?: string;
Expand All @@ -84,7 +84,9 @@ export function HashLink({
<a
className={classNames('no-underline text-inherit hover:text-inherit', className, {
'select-none': !canSelectText,
'transition-opacity opacity-0 focus:opacity-100 group-hover:opacity-70': hover,
'transition-opacity opacity-0 focus:opacity-100 group-hover:opacity-70': hover === true,
'[@media(hover:hover)]:transition-opacity [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:focus:opacity-100 [@media(hover:hover)]:group-hover:opacity-70':
hover === 'desktop',
'hover:underline': !hover,
})}
onClick={scroll}
Expand Down
2 changes: 1 addition & 1 deletion packages/site/src/components/Footnotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function Footnotes({
key={(ref as GenericNode).key}
id={`fnref-${(ref as GenericNode).key}`}
title="Link to Content"
hover
hover="desktop"
className="p-1"
children="↩"
scrollBehavior="instant"
Expand Down

0 comments on commit a4350b4

Please sign in to comment.