move @font-face into function component

main
Mike Fix 5 years ago
parent 754965198d
commit ff26f0f624

@ -400,15 +400,7 @@ class Editor extends React.Component {
</Overlay> </Overlay>
)} )}
</Dropzone> </Dropzone>
<style jsx global> <FontFace {...config} />
{`
@font-face {
font-family: ${config.fontUrl ? config.fontFamily : ''};
src: url(${config.fontUrl || ''}) format('woff');
font-display: swap;
}
`}
</style>
<style jsx> <style jsx>
{` {`
.editor { .editor {
@ -429,6 +421,20 @@ class Editor extends React.Component {
} }
} }
function FontFace(config) {
return (
<style jsx global>
{`
@font-face {
font-family: ${config.fontUrl ? config.fontFamily : ''};
src: url(${config.fontUrl || ''}) format('woff');
font-display: swap;
}
`}
</style>
)
}
function isImage(file) { function isImage(file) {
return file.type.split('/')[0] === 'image' return file.type.split('/')[0] === 'image'
} }

Loading…
Cancel
Save