qcast-front/src/store/fontAtom.js

30 lines
699 B
JavaScript

import { atom, selectorFamily } from 'recoil'
const defaultFont = {
fontFamily: { name: 'MS PGothic', value: 'MS PGothic' },
fontWeight: { name: '보통', value: 'normal' },
fontSize: { name: '16', value: '16' },
fontColor: { 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]
},
})