UNPKG

@hypothesis/frontend-shared

Version:

Shared components, styles and utilities for Hypothesis projects

52 lines (50 loc) 1.65 kB
var _jsxFileName = "/home/runner/work/frontend-shared/frontend-shared/src/components/navigation/Link.js"; import classnames from 'classnames'; import { downcastRef } from '../../util/typing'; import LinkBase from './LinkBase'; /** * @typedef {import('../../types').PresentationalProps} CommonProps * @typedef {import('preact').JSX.HTMLAttributes<HTMLAnchorElement>} HTMLAnchorAttributes * * @typedef LinkProps * @prop {'always'|'hover'|'none'} [underline] * @prop {'brand'|'text-light'|'text'} [color='brand'] */ /** * Styled component for a link (`<a>` element). * * @param {CommonProps & LinkProps & HTMLAnchorAttributes} props */ import { jsxDEV as _jsxDEV } from "preact/jsx-dev-runtime"; export default function Link({ children, classes, elementRef, underline = 'none', color = 'brand', ...htmlAttributes }) { return _jsxDEV(LinkBase, { ...htmlAttributes, className: classnames('focus-visible-ring rounded-sm', { // color 'text-brand hover:text-brand-dark': color === 'brand', // default 'text-color-text-light hover:text-brand': color === 'text-light', 'text-color-text hover:text-brand-dark': color === 'text' }, { // underline 'no-underline hover:no-underline': underline === 'none', // default 'underline hover:underline': underline === 'always', 'no-underline hover:underline': underline === 'hover' }, classes), elementRef: downcastRef(elementRef), "data-component": "Link", children: children }, void 0, false, { fileName: _jsxFileName, lineNumber: 32, columnNumber: 5 }, this); } //# sourceMappingURL=Link.js.map