import * as React from 'react' ; import { Select } from '../../components/select' ; import { DEFAULT_FONT_FACE , FONT_FACE } from '../../components/editor/squireConfig' ; interface Props { id : string ; fontFace : string ; onChange : ( value : string ) => void ; loading : boolean ; } const FontFaceSelect = ( { id , fontFace , onChange , loading , ... rest } ) => { const options = Object . entries ( FONT_FACE ) . map ( ( [ text , value ] ) => ( { text , value } ) ) ; const fontFaceValue = fontFace === undefined || fontFace === null ? DEFAULT_FONT_FACE : fontFace ; const handleChange = ( { target } ) => { onChange ( target . value ) ; } ; return ( < Select id = { id } value = { fontFaceValue } options = { options } disabled = { loading } onChange = { handleChange } { ... rest } />); } ; export default FontFaceSelect ;