json-joy
Version:
Collection of libraries for building collaborative editing apps.
41 lines (40 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Link = void 0;
const tslib_1 = require("tslib");
// biome-ignore lint: React is used for JSX
const React = tslib_1.__importStar(require("react"));
const nano_theme_1 = require("nano-theme");
const col = '#05f';
const blockClass = (0, nano_theme_1.rule)({
col,
td: 'underline',
textDecorationColor: col,
textDecorationThickness: '1px',
textDecorationStyle: 'wavy',
textUnderlineOffset: '.25em',
// textDecorationSkipInk: 'all',
'&:hover': {
col: col,
},
pd: 0,
mr: 0,
// Needed temporarily, to reset nano-theme styles
bdb: 'none',
'p &': {
bdb: 'none',
'&:hover': {
bdb: 'none',
},
},
});
const Link = (props) => {
const { children, layers = 1, stack } = props;
const style = layers < 2
? void 0
: {
textDecorationThickness: Math.max(Math.min(0.5 + layers * 0.5, 3), 1) + 'px',
};
return (React.createElement("span", { className: blockClass, style: style, title: stack[0].slice.data()?.title }, children));
};
exports.Link = Link;