UNPKG

react95-native

Version:

Refreshed Windows 95 style UI components for your React Native app

59 lines (56 loc) 1.65 kB
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import React from 'react'; import { StyleSheet, View } from 'react-native'; import { withTheme } from '../../core/theming'; import CardContent from './CardContent'; // TODO: add following props: // onLongPress, // onPress, const Card = ({ children, elevation: elevationProp = 1, style = {}, theme, ...rest }) => { const elevation = elevationProp * 2; return /*#__PURE__*/React.createElement(View, _extends({ style: [styles.wrapper, style] }, rest), /*#__PURE__*/React.createElement(View, { style: [styles.inner, { marginRight: elevation, marginBottom: elevation }] }, elevation !== 0 && /*#__PURE__*/React.createElement(View, { style: [styles.shadow, { top: elevation, left: elevation, width: '100%', height: '100%', backgroundColor: theme.borderDarkest }] }), /*#__PURE__*/React.createElement(View, { style: [styles.card, { backgroundColor: theme.canvas, borderColor: theme.borderDarkest }] }, children))); }; const styles = StyleSheet.create({ wrapper: { flex: 1, position: 'relative' }, inner: { flexGrow: 1 }, card: { borderWidth: 2, flexGrow: 1 }, shadow: { position: 'absolute' } }); Card.Content = CardContent; export default withTheme(Card); //# sourceMappingURL=Card.js.map