Add font size settings component
[MAILPOET-2604]
This commit is contained in:
committed by
Veljko V
parent
48e4f2b430
commit
40570f17d0
39
assets/js/src/form_editor/components/font_size_settings.tsx
Normal file
39
assets/js/src/form_editor/components/font_size_settings.tsx
Normal 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;
|
Reference in New Issue
Block a user