import WithDraggable from '@/components/common/draggable/WithDraggable' import QSelectBox from '@/components/common/select/QSelectBox' import { usePopup } from '@/hooks/usePopup' import { useEffect, useState } from 'react' import { useMessage } from '@/hooks/useMessage' import { useRecoilValue } from 'recoil' import { contextPopupPositionState } from '@/store/popupAtom' import { useCanvasSetting } from '@/hooks/option/useCanvasSetting' const fonts = [ { id: 1, name: 'MS PGothic', value: 'MS PGothic' }, { id: 2, name: '@Yu Gothic', value: '@Yu Gothic' }, { id: 3, name: 'Yu Gothic', value: 'Yu Gothic' }, { id: 4, name: '@Yu Gothic UI', value: '@Yu Gothic UI' }, { id: 5, name: 'Yu Gothic UI', value: 'Yu Gothic UI' }, ] const fontSizes = [ ...Array.from({ length: 4 }).map((_, index) => { return { id: index + 8, name: index + 8, value: index + 8 } }), ...Array.from({ length: 9 }).map((_, index) => { return { id: (index + 6) * 2, name: (index + 6) * 2, value: (index + 6) * 2 } }), { id: 36, name: 36, value: 36 }, { id: 48, name: 48, value: 48 }, { id: 72, name: 72, value: 72 }, ] export default function FontSetting(props) { const contextPopupPosition = useRecoilValue(contextPopupPositionState) const { id, setIsShow, pos = contextPopupPosition, type, isConfig = false, onSave, font } = props const { getMessage } = useMessage() const { closePopup } = usePopup() const [selectedFont, setSelectedFont] = useState(font.fontFamily) const [selectedFontWeight, setSelectedFontWeight] = useState(font.fontWeight) const [selectedFontSize, setSelectedFontSize] = useState(font.fontSize) const [selectedFontColor, setSelectedFontColor] = useState(font.fontColor) const fontOptions = [ { id: 'normal', name: getMessage('font.style.normal'), value: 'normal' }, { id: 'italic', name: getMessage('font.style.italic'), value: 'italic' }, { id: 'bold', name: getMessage('font.style.bold'), value: 'bold' }, { id: 'boldAndItalic', name: getMessage('font.style.bold.italic'), value: 'boldAndItalic' }, ] const fontColors = [ { id: 'black', name: getMessage('color.black'), value: 'black' }, { id: 'red', name: getMessage('color.red'), value: 'red' }, { id: 'blue', name: getMessage('color.blue'), value: 'blue' }, { id: 'gray', name: getMessage('color.gray'), value: 'gray' }, { id: 'yellow', name: getMessage('color.yellow'), value: 'yellow' }, { id: 'green', name: getMessage('color.green'), value: 'green' }, { id: 'pink', name: getMessage('color.pink'), value: 'pink' }, { id: 'gold', name: getMessage('color.gold'), value: 'gold' }, { id: 'darkblue', name: getMessage('color.darkblue'), value: 'darkblue' }, ] const handleSaveBtn = () => { onSave({ fontFamily: selectedFont, fontWeight: selectedFontWeight, fontSize: selectedFontSize, fontColor: selectedFontColor, }) if (setIsShow) setIsShow(false) closePopup(id, isConfig) } return (

{getMessage('modal.font')}

{getMessage('modal.font')}(F)
setSelectedFont(e)} />
{getMessage('modal.font.style')}(Y)
setSelectedFontWeight(e)} />
{getMessage('modal.font.size')}(S)
setSelectedFontSize(e)} />
{getMessage('modal.font.color')}
setSelectedFontColor(e)} />
{getMessage('modal.font.setting.display')}
Aaあぁアァ
{getMessage('modal.font.setting.info')}
) }