UNPKG

@gechiui/block-editor

Version:
52 lines (50 loc) 1.55 kB
import { createElement } from "@gechiui/element"; /** * GeChiUI dependencies */ import { Button } from '@gechiui/components'; import { __ } from '@gechiui/i18n'; import { formatCapitalize, formatLowercase, formatUppercase } from '@gechiui/icons'; const TEXT_TRANSFORMS = [{ name: __('大写'), value: 'uppercase', icon: formatUppercase }, { name: __('小写'), value: 'lowercase', icon: formatLowercase }, { name: __('首字母大写'), value: 'capitalize', icon: formatCapitalize }]; /** * Control to facilitate text transform selections. * * @param {Object} props Component props. * @param {string} props.value Currently selected text transform. * @param {Function} props.onChange Handles change in text transform selection. * * @return {GCElement} Text transform control. */ export default function TextTransformControl(_ref) { let { value, onChange } = _ref; return createElement("fieldset", { className: "block-editor-text-transform-control" }, createElement("legend", null, __('字母实例')), createElement("div", { className: "block-editor-text-transform-control__buttons" }, TEXT_TRANSFORMS.map(textTransform => { return createElement(Button, { key: textTransform.value, icon: textTransform.icon, isSmall: true, isPressed: value === textTransform.value, "aria-label": textTransform.name, onClick: () => onChange(value === textTransform.value ? undefined : textTransform.value) }); }))); } //# sourceMappingURL=index.js.map