react95-native
Version:
Refreshed Windows 95 style UI components for your React Native app
60 lines (57 loc) • 1.78 kB
JavaScript
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 { Button, Divider, ArrowIcon } from '../..';
const previewHeight = 20;
const ColorButton = ({
disabled,
color,
theme,
...rest
}) => {
return /*#__PURE__*/React.createElement(Button, _extends({
variant: "raised",
disabled: disabled
}, rest), /*#__PURE__*/React.createElement(View, {
style: styles.row
}, /*#__PURE__*/React.createElement(View, {
style: [styles.colorPreview, {
backgroundColor: color || 'transparent',
borderWidth: 2,
borderColor: disabled ? theme.materialTextDisabled : theme.materialText,
shadowColor: disabled ? theme.materialTextDisabledShadow : 'transparent',
shadowOffset: {
width: 1,
height: 1
},
shadowOpacity: 1,
shadowRadius: 0
}]
}), /*#__PURE__*/React.createElement(Divider, {
orientation: "vertical",
size: previewHeight
}), /*#__PURE__*/React.createElement(ArrowIcon, {
theme: theme,
direction: "down",
disabled: disabled,
segments: 3,
style: styles.dropdownIcon
})));
};
const styles = StyleSheet.create({
row: {
flexDirection: 'row'
},
colorPreview: {
width: 36,
marginRight: 6
},
dropdownIcon: {
alignSelf: 'center',
marginRight: 2,
marginLeft: 4
}
});
export default withTheme(ColorButton);
//# sourceMappingURL=ColorButton.js.map