qcast-front/src/store/fontAtom.js
2024-11-25 18:16:09 +09:00

30 lines
737 B
JavaScript

import { atom, selectorFamily } from 'recoil'
const defaultFont = {
fontFamily: { id: 1, name: 'MS PGothic', value: 'MS PGothic' },
fontWeight: { id: 'normal', name: '보통', value: 'normal' },
fontSize: { id: 16, name: 16, value: 16 },
fontColor: { id: 'black', name: '검정색', value: 'black' },
}
export const globalFontAtom = atom({
key: 'fontAtom',
default: {
commonText: defaultFont,
dimensionLineText: defaultFont,
flowText: defaultFont,
lengthText: defaultFont,
circuitNumberText: defaultFont,
},
})
export const fontSelector = selectorFamily({
key: 'fontSelector',
get:
(type) =>
({ get }) => {
const fontAtom = get(globalFontAtom)
return fontAtom[type]
},
})