UNPKG

wix-style-react

Version:
57 lines 1.92 kB
import React from 'react'; import { Layout, Cell } from '../../Layout'; import Box from '../../Box'; const skinBackgroundRules = [ { when: skin => skin === 'standard', output: '', }, { when: skin => skin === 'inverted', output: '', }, { when: skin => skin === 'destructive', output: '', }, { when: skin => skin === 'premium', output: '', }, { when: skin => skin === 'light', output: '#162d3d', }, { when: skin => skin === 'transparent', output: '#4eb7f5', }, { when: skin => skin === 'dark', output: '#fef0ba', }, { when: skin => skin === 'premium-light', output: '#162d3d', }, { when: () => true, output: '', }, ]; export const getSkinBackground = skin => skinBackgroundRules.find(({ when }) => when(skin)).output; export const renderButtonBlock = ({ Component, props = {}, skins }) => (React.createElement("div", { style: { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', backgroundColor: '#f0f4f7', } }, React.createElement(Box, { width: "400px" }, React.createElement(Layout, null, React.createElement(Cell, { span: 6 }, skins.map(({ skin, background }, index) => (React.createElement("div", { key: index, style: { background, margin: '5px 0' } }, React.createElement(Component, { children: skin, ...props, fullWidth: true, skin: skin }))))), React.createElement(Cell, { span: 6 }, skins.map(({ skin, background }, index) => (React.createElement("div", { key: index, style: { background, margin: '5px 0' } }, React.createElement(Component, { children: skin, ...props, fullWidth: true, skin: skin, disabled: true }))))))))); //# sourceMappingURL=index.js.map