UNPKG

@fluido/react-components

Version:
34 lines (33 loc) 1.66 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const classnames_1 = __importDefault(require("classnames")); const framer_motion_1 = require("framer-motion"); const styled_components_1 = __importDefault(require("styled-components")); const StyledSurface = styled_components_1.default(framer_motion_1.motion.div) ` position: relative; background-color: var(--surface); color: var(--on-surface-high-emphasis); border-radius: ${(p) => (p.radius && ((!isNaN(parseFloat(p.radius)) && p.radius + 'px') || p.radius)) || 0}; `; const Surface = (_a) => { var { children, className, elevation = 1, radius = 0 } = _a, props = __rest(_a, ["children", "className", "elevation", "radius"]); return (jsx_runtime_1.jsx(StyledSurface, Object.assign({ radius: radius, className: classnames_1.default(className, `elevation-${elevation}`) }, props, { children: children }), void 0)); }; exports.default = Surface;