|
|
@ -33,11 +33,10 @@ function FontSelect(props) {
|
|
|
|
|
|
|
|
|
|
|
|
updateFonts(fonts => [{ id: name, name, url }, ...fonts])
|
|
|
|
updateFonts(fonts => [{ id: name, name, url }, ...fonts])
|
|
|
|
props.onChange('fontFamily', name)
|
|
|
|
props.onChange('fontFamily', name)
|
|
|
|
props.onChange('fontUrl', url)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div>
|
|
|
|
<ListSetting
|
|
|
|
<ListSetting
|
|
|
|
title="Font"
|
|
|
|
title="Font"
|
|
|
|
items={[{ id: 'upload', name: 'Upload +' }, ...fonts]}
|
|
|
|
items={[{ id: 'upload', name: 'Upload +' }, ...fonts]}
|
|
|
@ -46,15 +45,30 @@ function FontSelect(props) {
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{Font}
|
|
|
|
{Font}
|
|
|
|
</ListSetting>
|
|
|
|
</ListSetting>
|
|
|
|
<input ref={inputEl} type="file" multiple accept={EXTENSIONS.join(',')} onChange={onFiles} />
|
|
|
|
<input
|
|
|
|
<style jsx>
|
|
|
|
hidden
|
|
|
|
|
|
|
|
ref={inputEl}
|
|
|
|
|
|
|
|
type="file"
|
|
|
|
|
|
|
|
multiple
|
|
|
|
|
|
|
|
accept={EXTENSIONS.join(',')}
|
|
|
|
|
|
|
|
onChange={onFiles}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
{fonts
|
|
|
|
|
|
|
|
.filter(font => font.url)
|
|
|
|
|
|
|
|
.map(font => (
|
|
|
|
|
|
|
|
<style jsx global key={font.id}>
|
|
|
|
{`
|
|
|
|
{`
|
|
|
|
input {
|
|
|
|
@font-face {
|
|
|
|
display: none;
|
|
|
|
font-family: '${font.name}';
|
|
|
|
|
|
|
|
src: url(${font.url}) format('woff');
|
|
|
|
|
|
|
|
font-display: swap;
|
|
|
|
|
|
|
|
font-style: normal;
|
|
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`}
|
|
|
|
`}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
</>
|
|
|
|
))}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|