UNPKG

@kbfront/kb-ui

Version:

KB React UI Library

50 lines 2.67 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ETextAlign = exports.ETextTransform = exports.ETextWeight = void 0; var react_1 = __importDefault(require("react")); var useWindowSize_1 = require("utils/hooks/useWindowSize"); var index_1 = require("../../enum/index"); require("./index.scss"); var ETextWeight; (function (ETextWeight) { ETextWeight[ETextWeight["THIN"] = 100] = "THIN"; ETextWeight[ETextWeight["EXTRA_LIGHT"] = 200] = "EXTRA_LIGHT"; ETextWeight[ETextWeight["LIGHT"] = 300] = "LIGHT"; ETextWeight[ETextWeight["NORMAL"] = 400] = "NORMAL"; ETextWeight[ETextWeight["MEDIUM"] = 500] = "MEDIUM"; ETextWeight[ETextWeight["SEMI_BOLD"] = 600] = "SEMI_BOLD"; ETextWeight[ETextWeight["BOLD"] = 700] = "BOLD"; ETextWeight[ETextWeight["EXTRA_BOLD"] = 800] = "EXTRA_BOLD"; ETextWeight[ETextWeight["BLACK"] = 900] = "BLACK"; ETextWeight[ETextWeight["EXTRA_BLACK"] = 950] = "EXTRA_BLACK"; })(ETextWeight = exports.ETextWeight || (exports.ETextWeight = {})); var ETextTransform; (function (ETextTransform) { ETextTransform["UPPERCASE"] = "uppercase"; ETextTransform["LOWERCASE"] = "lowercase"; ETextTransform["CAPITALIZE"] = "capitalize"; ETextTransform["NONE"] = "none"; })(ETextTransform = exports.ETextTransform || (exports.ETextTransform = {})); var ETextAlign; (function (ETextAlign) { ETextAlign["LEFT"] = "left"; ETextAlign["CENTER"] = "center"; ETextAlign["RIGHT"] = "right"; })(ETextAlign = exports.ETextAlign || (exports.ETextAlign = {})); var Text = function (_a) { var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b, _c = _a.color, color = _c === void 0 ? index_1.EColor.BLACK : _c, _d = _a.weight, weight = _d === void 0 ? ETextWeight.NORMAL : _d, _e = _a.align, align = _e === void 0 ? ETextAlign.LEFT : _e, _f = _a.lineHeight, lineHeight = _f === void 0 ? 1 : _f, _g = _a.transform, transform = _g === void 0 ? ETextTransform.NONE : _g, _h = _a.fontSize, fontSize = _h === void 0 ? 1 : _h, title = _a.title; var resize = useWindowSize_1.useWindowSize(); var style = { fontWeight: weight, textAlign: align, lineHeight: lineHeight, fontSize: fontSize + "rem", textTransform: transform, }; return (react_1.default.createElement("span", { title: title && title, style: resize > 768 ? style : null, className: "kb-text color-" + color + " " + className }, children)); }; exports.default = Text; //# sourceMappingURL=index.js.map