import PropTypes from "prop-types";
import Icons from "./icons";
import { __ } from "@wordpress/i18n";
const { Component, Fragment } = wp.element;
const { Button, Popover, Dashicon, ColorIndicator, Tooltip, Icon } =
wp.components;
// /**
// * WordPress dependencies
// */
// import { site, Icon } from '@wordpress/icons';
export const SwatchesControl = ({
colors,
isPalette,
onClick = () => {},
circleSize,
circleSpacing,
}) => {
const handleClick = (color, swatch) => {
onClick(
{
hex: color,
},
swatch
);
};
return (
{colors.map((colorObjOrString) => {
const c =
typeof colorObjOrString === "string"
? { color: colorObjOrString }
: colorObjOrString;
const key = `${c.color}${c.slug || ""}`;
return (
);
})}
);
};
SwatchesControl.defaultProps = {
circleSize: 26,
circleSpacing: 15,
};
SwatchesControl.propTypes = {
colors: PropTypes.arrayOf(
PropTypes.oneOfType([
PropTypes.string,
PropTypes.shape({
color: PropTypes.string,
slug: PropTypes.string,
name: PropTypes.string,
}),
])
).isRequired,
isPalette: PropTypes.string,
};
export default SwatchesControl;