@brizy/ui
Version:
React elements in Brizy style
18 lines (17 loc) • 1.07 kB
JavaScript
import React, { useCallback } from "react";
import AntTypographyLink from "antd/lib/typography/Link";
import { classNames } from "../classNamesFn";
import { getItalic, getTypographyLinkColor } from "./utils";
export const TypographyLink = props => {
const { strong, underline, href, target, color, italic, hoverColor, ellipsis, children, onClick } = props;
const className = classNames(getItalic(italic))("typography__link", {
"typography__link__color-inherit": color === "inherit",
"typography__link__hoverColor-inherit": hoverColor === "inherit",
typography__link__hoverColor: color === "inherit" && hoverColor,
typography__hoverColor: hoverColor,
});
const _onClick = useCallback(() => {
onClick === null || onClick === void 0 ? void 0 : onClick();
}, [onClick]);
return (React.createElement(AntTypographyLink, { strong: strong, className: className, style: getTypographyLinkColor(color, hoverColor), underline: underline, href: href, target: target, ellipsis: ellipsis, onClick: _onClick }, children));
};