@yandex/ui
Version:
Yandex UI components
32 lines (31 loc) • 1.14 kB
JavaScript
import { __assign } from "tslib";
import React from 'react';
import { cnMessageBox } from '../MessageBox';
import './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),
}); },
};
export var MessageBoxCorner = function (_a) {
var children = _a.children, side = _a.side, width = _a.width, height = _a.height;
if (!height) {
height = width;
}
var style = __assign({ width: width,
height: height }, sidePositionCalc[side](width, height));
return (React.createElement("span", { className: cnMessageBox('Corner'), style: style }, children));
};