UNPKG

@smitch/fluid

Version:

A Next/React ui-component libray.

21 lines (20 loc) 996 B
import { jsx as _jsx } from "react/jsx-runtime"; import { useMemo } from 'react'; var sizes = { sm: 'text-sm', md: 'text-base', lg: 'text-lg', xl: 'text-2xl', }; var alignments = { left: 'text-left', center: 'text-center', right: 'text-right', }; var Legend = function (_a) { var text = _a.text, _b = _a.isBold, isBold = _b === void 0 ? false : _b, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.align, align = _d === void 0 ? 'center' : _d, _e = _a.legendSize, legendSize = _e === void 0 ? 'md' : _e; var sizeClasses = useMemo(function () { return sizes[legendSize]; }, [legendSize]); var alignment = useMemo(function () { return alignments[align]; }, [align]); return (_jsx("legend", { className: "legend ".concat(className, " ").concat(alignment, " ").concat(isBold ? 'font-bold' : 'font-normal', " text-").concat(align, " ").concat(sizeClasses, " text-dark dark:text-light mb-[1em]"), children: text })); }; export default Legend;