@ozen-ui/kit
Version:
React component library
26 lines (25 loc) • 1.33 kB
JavaScript
import { __assign, __rest } from "tslib";
import './Link.css';
import React from 'react';
import { classnames } from '@bem-react/classnames';
import { useThemeProps } from '../../hooks/useThemeProps';
import { cn } from '../../utils/classname';
import { polymorphicComponentWithRef, } from '../../utils/polymorphicComponentWithRef';
import { cnTypography } from '../Typography';
export var cnLink = cn('Link');
export var Link = polymorphicComponentWithRef(function (inProps, ref) {
var props = useThemeProps({
props: inProps,
name: 'Link',
});
var _a = props.variant, variant = _a === void 0 ? 'text-m' : _a, _b = props.as, Tag = _b === void 0 ? 'a' : _b, display = props.display, noWrap = props.noWrap, align = props.align, defaultMargin = props.defaultMargin, children = props.children, className = props.className, other = __rest(props, ["variant", "as", "display", "noWrap", "align", "defaultMargin", "children", "className"]);
return (React.createElement(Tag, __assign({ className: classnames(cnLink(), cnTypography({
variant: variant,
display: display,
defaultMargin: defaultMargin,
align: align,
noWrap: noWrap,
link: true,
}), className) }, other, { ref: ref }), children));
});
Link.displayName = 'Link';