UNPKG

@retriever-ui/typography

Version:
33 lines (32 loc) 1.69 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.useCommonProps = void 0; var react_1 = __importDefault(require("react")); var useCommonProps = function (_a) { var textAlign = _a.textAlign; var alignment = react_1.default.useMemo(function () { if (typeof textAlign === 'undefined') { return { sm: 'left', md: 'left', lg: 'left' }; } if (typeof textAlign === 'string') { return { sm: textAlign, md: textAlign, lg: textAlign }; } if (Array.isArray(textAlign)) { return { sm: (textAlign === null || textAlign === void 0 ? void 0 : textAlign[0]) || 'left', md: (textAlign === null || textAlign === void 0 ? void 0 : textAlign[1]) || (textAlign === null || textAlign === void 0 ? void 0 : textAlign[0]) || 'left', lg: (textAlign === null || textAlign === void 0 ? void 0 : textAlign[2]) || (textAlign === null || textAlign === void 0 ? void 0 : textAlign[1]) || (textAlign === null || textAlign === void 0 ? void 0 : textAlign[0]) || 'left', }; } return { sm: (textAlign === null || textAlign === void 0 ? void 0 : textAlign.sm) || 'left', md: (textAlign === null || textAlign === void 0 ? void 0 : textAlign.md) || 'left', lg: (textAlign === null || textAlign === void 0 ? void 0 : textAlign.lg) || 'left', }; }, [textAlign]); return { alignment: alignment }; }; exports.useCommonProps = useCommonProps;