react-smartphone
Version:

37 lines • 1.85 kB
JavaScript
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import { jsx as _jsx } from "react/jsx-runtime";
import styled from 'styled-components';
import { dark, phoneWidth, phoneHeight, borderRadius } from './constants';
var Screen = function (props) {
var color = props.color, height = props.height, width = props.width;
return (_jsx(Container, __assign({ color: color, height: height, width: width }, { children: props.children }), void 0));
};
export default Screen;
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n height: ", ";\n width: ", ";\n margin-top: -20px;\n position: relative;\n border-radius: ", ";\n overflow: hidden;\n"], ["\n background-color: ",
";\n height: ",
";\n width: ",
";\n margin-top: -20px;\n position: relative;\n border-radius: ", ";\n overflow: hidden;\n"])), function (props) {
return props.color ? props.color : dark;
}, function (props) {
return props.height ? "calc(" + props.height + " - 95px)" : phoneHeight - 110 + 'px';
}, function (props) {
return props.width
? "min(calc(" + props.width + " - 30px), calc(100% - 30px))"
: phoneWidth - 60 + 'px';
}, borderRadius);
var templateObject_1;
//# sourceMappingURL=Screen.js.map