@ant-design/icons#FormatPainterOutlined JavaScript Examples

The following examples show how to use @ant-design/icons#FormatPainterOutlined. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetadataEditor.jsx    From ui with MIT License 5 votes vote down vote up
MetadataEditor = (props) => {
  const {
    onReplaceEmpty,
    onReplaceAll,
    onClearAll,
    massEdit,
    children,
    ...restOfProps
  } = props;

  const [value, setValue] = useState('');

  const onChange = (e) => {
    setValue(e?.target?.value || e);
  };

  const getContent = () => (
    <Space direction='vertical'>
      {React.cloneElement(children, {
        onChange,
        value,
      })}
      <Divider style={{ margin: '4px 0' }} />

      {massEdit
        ? (
          <Space>
            <Button
              type='primary'
              size='small'
              onClick={() => onReplaceEmpty(value)}
            >
              Fill all missing

            </Button>
            <Button size='small' onClick={() => onReplaceAll(value)}> Replace all</Button>
            <Button type='warning' size='small' onClick={() => onClearAll()}> Clear all</Button>
          </Space>
        )
        : (
          <Space>
            <Button type='primary' size='small'>Save</Button>
            <Button size='small'>Cancel</Button>
          </Space>
        )}
    </Space>
  );

  return (
    <Tooltip title='Fill'>
      <Popover title='Fill metadata' content={getContent()} trigger='click'>
        <Button size='small' shape='circle' icon={<FormatPainterOutlined />} {...restOfProps} />
      </Popover>
    </Tooltip>
  );
  /* eslint-enable react/jsx-props-no-spreading */
}