Render submit button gradient on front end
[MAILPOET-3005]
This commit is contained in:
committed by
Veljko V
parent
74ad8c4952
commit
12dff2c34d
@ -8,7 +8,7 @@ class BlockStylesRenderer {
|
|||||||
if (isset($styles['full_width']) && intval($styles['full_width'])) {
|
if (isset($styles['full_width']) && intval($styles['full_width'])) {
|
||||||
$rules[] = 'width:100%;';
|
$rules[] = 'width:100%;';
|
||||||
}
|
}
|
||||||
if (isset($styles['background_color'])) {
|
if (isset($styles['background_color']) && empty($styles['gradient'])) {
|
||||||
$rules[] = "background-color:{$styles['background_color']};";
|
$rules[] = "background-color:{$styles['background_color']};";
|
||||||
}
|
}
|
||||||
if (isset($styles['border_size']) || isset($styles['border_radius']) || isset($styles['border_color'])) {
|
if (isset($styles['border_size']) || isset($styles['border_radius']) || isset($styles['border_color'])) {
|
||||||
@ -56,6 +56,9 @@ class BlockStylesRenderer {
|
|||||||
if (!isset($styles['border_color'])) {
|
if (!isset($styles['border_color'])) {
|
||||||
$rules[] = "border-color:transparent;";
|
$rules[] = "border-color:transparent;";
|
||||||
}
|
}
|
||||||
|
if (!empty($styles['gradient'])) {
|
||||||
|
$rules[] = "background: {$styles['gradient']};";
|
||||||
|
}
|
||||||
if (isset($styles['bold']) && $styles['bold'] === '1') {
|
if (isset($styles['bold']) && $styles['bold'] === '1') {
|
||||||
$rules[] = "font-weight:bold;";
|
$rules[] = "font-weight:bold;";
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,18 @@ class BlockStylesRendererTest extends \MailPoetUnitTest {
|
|||||||
expect($result)->contains('padding:40px;');
|
expect($result)->contains('padding:40px;');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testItShouldRenderButtonGradient() {
|
||||||
|
$styles = [
|
||||||
|
'gradient' => 'linear-gradient(#eee, #ddd)',
|
||||||
|
];
|
||||||
|
$settings = [
|
||||||
|
'input_padding' => '40',
|
||||||
|
'fontSize' => 13,
|
||||||
|
];
|
||||||
|
$result = $this->renderer->renderForButton($styles, $settings);
|
||||||
|
expect($result)->contains('background: linear-gradient(#eee, #ddd);');
|
||||||
|
}
|
||||||
|
|
||||||
public function testItShouldRenderSegmentInputStyles() {
|
public function testItShouldRenderSegmentInputStyles() {
|
||||||
expect($this->renderer->renderForSelect([], ['input_padding' => 10]))->equals('padding:10px;');
|
expect($this->renderer->renderForSelect([], ['input_padding' => 10]))->equals('padding:10px;');
|
||||||
expect($this->renderer->renderForSelect([], ['alignment' => 'right']))->equals('margin: 0 0 0 auto;');
|
expect($this->renderer->renderForSelect([], ['alignment' => 'right']))->equals('margin: 0 0 0 auto;');
|
||||||
|
Reference in New Issue
Block a user