Add color to divider

[MAILPOET-2835]
This commit is contained in:
Pavel Dohnal
2020-04-28 15:35:46 +02:00
committed by Veljko V
parent fd65928c96
commit d7b514d526
2 changed files with 10 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import React from 'react';
import classnames from 'classnames';
import MailPoet from 'mailpoet';
import { InspectorControls } from '@wordpress/block-editor';
import ColorSettings from 'form_editor/components/color_settings';
import {
Panel,
PanelBody,
@@ -50,6 +51,11 @@ const DividerEdit = ({ attributes, setAttributes }: Props) => {
allowReset
onChange={(dividerWidth) => (setAttributes({ dividerWidth }))}
/>
<ColorSettings
name={MailPoet.I18n.t('blockDividerColor')}
value={attributes.color}
onChange={(color) => (setAttributes({ color }))}
/>
</>
);
@@ -57,6 +63,7 @@ const DividerEdit = ({ attributes, setAttributes }: Props) => {
if (attributes.type === Types.Divider) {
dividerStyles.borderTopStyle = attributes.style;
dividerStyles.borderTopWidth = attributes.dividerHeight;
dividerStyles.borderTopColor = attributes.color;
dividerStyles.height = attributes.dividerHeight;
dividerStyles.width = `${attributes.dividerWidth}%`;
}