1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-13 05:45:31 -04:00
Files
jarv.is/assets/js/src/components/Anchor.js

22 lines
621 B
JavaScript

import { h } from "preact";
import isTouchDevice from "is-touch-device";
const Anchor = (props) => {
return (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
class="anchorjs-link"
href={`#${props.id}`}
title={`Jump to "${props.title}"`}
aria-label={`Jump to "${props.title}"`}
style={{
// if this is a touchscreen, always show the "#" icon instead waiting for hover
// NOTE: this is notoriously unreliable; see https://github.com/Modernizr/Modernizr/pull/2432
opacity: isTouchDevice() ? 1 : null,
}}
/>
);
};
export default Anchor;