UNPKG

@brizy/ui

Version:
18 lines (17 loc) 1.27 kB
import React, { useCallback } from "react"; import { classNames } from "../classNamesFn"; import AntTypographyParagraph from "antd/lib/typography/Paragraph"; import { getAlign, getFontSize, getTypographyParagraphColor, getItalic, } from "./utils"; export const TypographyParagraph = props => { const { code, strong, mark, italic, underline, color, hoverColor, align = "left", size = "middle", children, ellipsis, onClick, } = props; const className = classNames(getAlign(align), getFontSize(size), getItalic(italic))("typography__paragraph", { "typography__paragraph__color-inherit": color === "inherit", "typography__paragraph__hoverColor-inherit": hoverColor === "inherit", typography__paragraph__hoverColor: color === "inherit" && hoverColor, typography__hoverColor: hoverColor, }); const _onClick = useCallback(() => { onClick === null || onClick === void 0 ? void 0 : onClick(); }, [onClick]); return (React.createElement(AntTypographyParagraph, { className: className, code: code, strong: strong, mark: mark, underline: underline, ellipsis: ellipsis, style: getTypographyParagraphColor(color, hoverColor) }, onClick ? React.createElement("span", { onClick: _onClick }, children) : children)); };