import { useState } from 'react'; import { Flex, Segmented, Spin, Upload } from 'antd'; import { useFormContext } from 'react-hook-form'; import { ErrorMessage, Schemas } from '@l-clutch/core'; import { FormValues } from '.'; import { BackgroundEditor } from './BackgroundEditor'; import { InboxOutlined } from '@ant-design/icons'; import { useUploadProps } from './useUploadProps'; export const RichMenuImage = () => { const { formState: { errors }, watch, setValue, } = useFormContext(); const background = watch('background'); const [showActionArea, setShowActionArea] = useState(true); const { uploadProps, isUploading } = useUploadProps({ setImage: (image: Schemas['Image'] | undefined) => setValue('background', image, { shouldDirty: true }), }); return (
{background ? ( ) : (

{isUploading ? : }

リッチメニューの背景画像をアップロード

クリックまたは画像をドロップでアップロードできます。

)}
画像サイズ:{background?.width}×{background?.height} WordPressの画像エディター でサイズの変更が可能です。 } />
アクション領域 setShowActionArea(!!value)} disabled={!background} options={[ { label: '表示', value: 1 }, { label: '非表示', value: 0 }, ]} />
); };