brightyui
Version:
Brighty UI library
17 lines • 1.34 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { useMemo } from 'react';
import styles from '../../../src/styles/Typography.module.scss';
import { cnb } from 'cnbuilder';
import { EColors } from '../../types/EColors';
import useMediaQuery from '../../hooks/useMediaQuery';
var Typography = function (_a) {
var className = _a.className, children = _a.children, _b = _a.variant, variant = _b === void 0 ? 'pMediumMedium' : _b, _c = _a.align, align = _c === void 0 ? 'left' : _c, _d = _a.alignMobile, alignMobile = _d === void 0 ? 'left' : _d, _e = _a.color, color = _e === void 0 ? EColors.text0 : _e, lineThrough = _a.lineThrough;
var isMobile = useMediaQuery('(max-width: 577px)');
var finalAlign = useMemo(function () { return (isMobile ? alignMobile : align); }, [isMobile, align, alignMobile]);
if (variant === 'h1') {
return (_jsx("h1", { className: cnb(styles.text, styles[variant], className), style: { textAlign: finalAlign, color: color, textDecoration: lineThrough ? 'line-through' : 'none' }, children: children }));
}
return (_jsx("p", { className: cnb(styles.text, styles[variant], className), style: { textAlign: finalAlign, color: color, textDecoration: lineThrough ? 'line-through' : 'none' }, children: children }));
};
export default Typography;
//# sourceMappingURL=Typography.js.map