import React from 'react'; import { WithTranslation } from 'next-i18next'; import { withTranslation } from '../../i18n'; import Icon from '../Icon'; import Typography from '../Typography'; import SliderWithTitle from '../SliderWithTitle'; import ColorSelector from '../ColorSelector'; import SelectBox from '../SelectBox'; import { OptionPropsType, SelectOptionType } from '../../constants/type'; import { Wrapper, Group, Item, } from '../../global/toolStyled'; import { fontOptions, sizeOptions, alignOptions, styleOptions, } from './data'; type i18nProps = { t: (key: string) => string; } type Props = i18nProps & OptionPropsType; const TextOption: React.SFC = ({ t, fontName, fontSize, align, fontStyle, color, opacity, setDataState = (): void => { // do nothing }, }: Props) => ( <> {t('font')} { setDataState({ fontName: option.child }); }} /> { styleOptions.map(ele => ( { setDataState({ fontStyle: ele.child === fontStyle ? '' : ele.child }); }} > )) } {t('size')} { setDataState({ fontSize: option.child }); }} /> {t('align')} { alignOptions.map(ele => ( { setDataState({ align: ele.child }); }} > )) } { setDataState({ color: selected }); }} /> { setDataState({ opacity: val }); }} /> ); const translator = withTranslation('sidebar'); type TransProps = WithTranslation & OptionPropsType; export default translator(TextOption);