Add font size settings component

[MAILPOET-2604]
This commit is contained in:
Rostislav Wolny
2020-03-18 17:07:41 +01:00
committed by Veljko V
parent 48e4f2b430
commit 40570f17d0

View File

@@ -0,0 +1,39 @@
import React from 'react';
import {
FontSizePicker,
} from '@wordpress/components';
import { useSelect } from '@wordpress/data';
type Props = {
name: string,
value: number|undefined
onChange: (value: string|undefined) => any
}
const FontSizeSettings = ({
name,
value,
onChange,
}: Props) => {
const fontSizes = useSelect(
(select) => {
const { getSettings } = select('core/block-editor');
return getSettings().fontSizes;
},
[]
);
return (
<div>
<h3 className="mailpoet-styles-settings-heading">
{name}
</h3>
<FontSizePicker
value={value}
onChange={onChange}
fontSizes={fontSizes}
/>
</div>
);
};
export default FontSizeSettings;