UNPKG

@yandex/ui

Version:

Yandex UI components

36 lines (35 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageBoxCorner = void 0; var tslib_1 = require("tslib"); var react_1 = tslib_1.__importDefault(require("react")); var MessageBox_1 = require("../MessageBox"); require("./MessageBox-Corner.css"); var sidePositionCalc = { 'bottom-left': function (width, height) { return ({ left: -Math.floor(width / 3), bottom: -Math.floor(height / 3), }); }, 'bottom-right': function (width, height) { return ({ right: -Math.floor(width / 3), bottom: -Math.floor(height / 3), }); }, 'top-left': function (width, height) { return ({ left: -Math.floor(width / 3), top: -Math.floor(height / 3), }); }, 'top-right': function (width, height) { return ({ right: -Math.floor(width / 3), top: -Math.floor(height / 3), }); }, }; var MessageBoxCorner = function (_a) { var children = _a.children, side = _a.side, width = _a.width, height = _a.height; if (!height) { height = width; } var style = tslib_1.__assign({ width: width, height: height }, sidePositionCalc[side](width, height)); return (react_1.default.createElement("span", { className: MessageBox_1.cnMessageBox('Corner'), style: style }, children)); }; exports.MessageBoxCorner = MessageBoxCorner;