UNPKG

wix-style-react

Version:
23 lines 977 B
import React from 'react'; import PropTypes from 'prop-types'; import FillPreview from '../FillPreview/FillPreview'; import { classes } from './Palette.st.css'; /** A component to show a palette of colors */ class Palette extends React.PureComponent { render() { const { fill, dataHook } = this.props; return (React.createElement("div", { className: classes.root, "data-hook": dataHook }, fill.map((item, i) => (React.createElement(FillPreview, { as: "div", key: i, tabIndex: -1, className: classes.fillPreview, aspectRatio: "none", fill: item }))))); } } Palette.displayName = 'Palette'; Palette.propTypes = { /** Applies a data-hook HTML attribute that can be used in the tests. */ dataHook: PropTypes.string, /** Defines an array of fill items for the palette. Accepts solid colors, gradients or images. */ fill: PropTypes.array, }; Palette.defaultProps = { fill: [], }; export default Palette; //# sourceMappingURL=Palette.js.map