UNPKG

@wulperstudio/cms

Version:
29 lines 933 B
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; import React from 'react'; import { TagWS } from './styled'; import { jsx as _jsx } from "react/jsx-runtime"; var Tag = function Tag(props) { var _React$useState = React.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), isLabel = _React$useState2[0], setIsLabel = _React$useState2[1]; var handleLabel = function handleLabel(e) { e.stopPropagation(); setIsLabel(!isLabel); }; if (props.open) { return /*#__PURE__*/_jsx(TagWS, { backgroundColor: props.color, incrementHeight: props.incrementHeight, fontSizeIncrement: props.fontSizeIncrement, paddingIncrement: props.paddingIncrement, children: props.label }); } return /*#__PURE__*/_jsx(TagWS, { backgroundColor: props.color, onClick: handleLabel, children: isLabel && props.label }); }; export default Tag;