Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions classes/class-responsive-block-editor-addons-frontend-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -16932,6 +16932,8 @@ public static function get_responsive_block_call_mail_button_css( $attr, $id ) {
$button_background = 'transparent' === $attr['buttonStyleToggle'] ? '' : $attr['buttonColor'];
$text_color_hover = 'transparent' === $attr['buttonStyleToggle'] ? $attr['buttonColorHover'] : $attr['buttonTextColorHover'];
$button_background_hover = 'transparent' === $attr['buttonStyleToggle'] ? '' : $attr['buttonColorHover'];
$icon_color = isset( $attr['icon_color'] ) ? $attr['icon_color'] : '';
$icon_fill = ! empty( $icon_color ) ? $icon_color : $text_color;

$justify_content_direction = 'flex-start';
if ( 'left' === $attr['buttonAlign'] ) {
Expand Down Expand Up @@ -16971,7 +16973,7 @@ public static function get_responsive_block_call_mail_button_css( $attr, $id ) {
'justify-content' => $justify_content_direction,
),
' .responsive-block-editor-addons-call-mail-button-button-container' => array(
'width' => $button_width_css,
'width' => $flag ? '' : $button_width_css,
'border' => $flag ? '' : $button_border,
'background-color' => $flag ? '' : $button_background,
'border-radius' => $flag ? '' : $button_border_radius,
Expand All @@ -16987,7 +16989,10 @@ public static function get_responsive_block_call_mail_button_css( $attr, $id ) {
'font-style' => $flag ? '' : $attr['textFontStyle'],
),
' .responsive-block-editor-addons-call-mail-button-icon' => array(
'fill' => $text_color,
'fill' => $icon_fill,
),
' .responsive-block-editor-addons-call-mail-button-icon svg, .responsive-block-editor-addons-call-mail-button-icon svg path' => array(
'fill' => $icon_fill,
),
' .responsive-block-editor-addons-call-mail-button-icon svg' => array(
'height' => self::get_css_value( $attr['iconSize'], 'px' ) . ' !important',
Expand All @@ -17001,7 +17006,10 @@ public static function get_responsive_block_call_mail_button_css( $attr, $id ) {
'color' => $flag ? '' : $text_color_hover,
),
' .responsive-block-editor-addons-call-mail-button-button-container:hover .responsive-block-editor-addons-call-mail-button-icon' => array(
'fill' => $text_color_hover,
'fill' => ! empty( $icon_color ) ? $icon_color : $text_color_hover,
),
' .responsive-block-editor-addons-call-mail-button-button-container:hover .responsive-block-editor-addons-call-mail-button-icon svg, .responsive-block-editor-addons-call-mail-button-button-container:hover .responsive-block-editor-addons-call-mail-button-icon svg path' => array(
'fill' => ! empty( $icon_color ) ? $icon_color : $text_color_hover,
),
' .responsive-block-editor-addons-call-mail-button-icon-iconPosition-left' => array(
'margin-right' => self::get_css_value( $attr['iconTextGap'], 'px' ),
Expand All @@ -17013,7 +17021,7 @@ public static function get_responsive_block_call_mail_button_css( $attr, $id ) {

$mobile_selectors = array(
' .responsive-block-editor-addons-call-mail-button-button-container' => array(
'width' => $button_width_css_mobile,
'width' => $flag ? '' : $button_width_css_mobile,
),
' .responsive-block-editor-addons-call-mail-button-text' => array(
'font-size' => $flag ? '' : self::get_css_value( $attr['textFontSizeMobile'], 'px' ) . ' !important',
Expand All @@ -17038,7 +17046,7 @@ public static function get_responsive_block_call_mail_button_css( $attr, $id ) {

$tablet_selectors = array(
' .responsive-block-editor-addons-call-mail-button-button-container' => array(
'width' => $button_width_css_tablet,
'width' => $flag ? '' : $button_width_css_tablet,
),
' .responsive-block-editor-addons-call-mail-button-text' => array(
'font-size' => $flag ? '' : self::get_css_value( $attr['textFontSizeTablet'], 'px' ) . ' !important',
Expand Down Expand Up @@ -17084,9 +17092,9 @@ public static function get_responsive_block_call_mail_button_default_attributes(
'buttonWidth' => 200,
'buttonWidthMobile' => 200,
'buttonWidthTablet' => 200,
'iconSize' => '',
'iconSizeMobile' => '',
'iconSizeTablet' => '',
'iconSize' => 20,
'iconSizeMobile' => 20,
'iconSizeTablet' => 20,
'buttonColor' => '#4aac38',
'buttonTextColor' => '#ffffff',
'buttonColorHover' => '',
Expand Down
10 changes: 7 additions & 3 deletions src/blocks/call-mail-button/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,25 @@ const attributes = {
type: "string",
default: ""
},
icon_color: {
type: "string",
default: "",
},
iconPosition: {
type: "string",
default: "left"
},
iconSize: {
type: "number",
default: ""
default: "20"
},
iconSizeMobile: {
type: "number",
default: ""
default: "20"
},
iconSizeTablet: {
type: "number",
default: ""
default: "20"
},
//Colors
buttonColor: {
Expand Down
8 changes: 4 additions & 4 deletions src/blocks/call-mail-button/components/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ export default class Edit extends Component {
<div
className={classnames(
"responsive-block-editor-addons-call-mail-button-button-container",
buttonSize,
inheritFromTheme ? 'wp-block-button' : null,
inheritFromTheme ? null : buttonSize,
inheritFromTheme ? 'wp-block-button wp-block-button__link' : null,
)}
href={"call" === buttonToShow ? callHref : mailHref}
>
Expand All @@ -131,7 +131,7 @@ export default class Edit extends Component {
placeholder={__("Call", "responsive-block-editor-addons")}
value={callText}
className={classnames("responsive-block-editor-addons-call-mail-button-text",
inheritFromTheme ? "wp-block-button wp-block-button__link" : null)}
inheritFromTheme ? "wp-block-button" : null)}
onChange={(value) => setAttributes({ callText: value })}
multiline={false}
allowedFormats={[
Expand All @@ -150,7 +150,7 @@ export default class Edit extends Component {
onChange={(value) => setAttributes({ mailText: value })}
multiline={false}
className={classnames("responsive-block-editor-addons-call-mail-button-text",
inheritFromTheme ? "wp-block-button wp-block-button__link" : null)}
inheritFromTheme ? "wp-block-button" : null)}
allowedFormats={[
"core/bold",
"core/italic",
Expand Down
20 changes: 14 additions & 6 deletions src/blocks/call-mail-button/components/editor-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
buttonWidth,
buttonWidthMobile,
buttonWidthTablet,
icon_color,
iconSize,
iconSizeMobile,
iconSizeTablet,
Expand Down Expand Up @@ -78,6 +79,7 @@
let buttonBackground = buttonStyleToggle === "transparent" ? "" : buttonColor;
let textColorHover = buttonStyleToggle === "transparent" ? buttonColorHover : buttonTextColorHover;
let buttonBackgroundHover = buttonStyleToggle === "transparent" ? "" : buttonColorHover;
let iconFill = icon_color ? icon_color : textColor;

let justifyButtonDirection = 'flex-start';
if(buttonAlign === 'center') {
Expand All @@ -98,10 +100,10 @@
"justify-content": justifyButtonDirection,
},
" .responsive-block-editor-addons-call-mail-button-button-container": {
"width": buttonWidthCSS,
"width": inheritFromTheme ? '' : buttonWidthCSS,
"background-color": inheritFromTheme ? '' : buttonBackground,
"border": inheritFromTheme ? '' : buttonBorder,
"border-radius": buttonBorderRadius,
"border-radius": inheritFromTheme ? '' : buttonBorderRadius,
},
" .responsive-block-editor-addons-call-mail-button-button-container:hover": {
"background-color": inheritFromTheme ? '' : buttonBackgroundHover,
Expand All @@ -118,7 +120,10 @@
"font-style": textFontStyle,
},
" .responsive-block-editor-addons-call-mail-button-icon": {
"fill": textColor,
"fill": iconFill,
},
" .responsive-block-editor-addons-call-mail-button-icon svg, .responsive-block-editor-addons-call-mail-button-icon svg path": {
"fill": iconFill,
},
" .responsive-block-editor-addons-call-mail-button-icon svg": {
"height": `${generateCSSUnit(iconSize, "px")} !important`,
Expand All @@ -128,7 +133,10 @@
"color": inheritFromTheme ? '' : textColorHover,
},
" .responsive-block-editor-addons-call-mail-button-button-container:hover .responsive-block-editor-addons-call-mail-button-icon": {
"fill": inheritFromTheme ? '' : textColorHover,
"fill": icon_color ? icon_color : ( inheritFromTheme ? '' : textColorHover ),
},
" .responsive-block-editor-addons-call-mail-button-button-container:hover .responsive-block-editor-addons-call-mail-button-icon svg, .responsive-block-editor-addons-call-mail-button-button-container:hover .responsive-block-editor-addons-call-mail-button-icon svg path": {
"fill": icon_color ? icon_color : ( inheritFromTheme ? '' : textColorHover ),
},
" .responsive-block-editor-addons-call-mail-button-icon-iconPosition-left": {
"margin-right": generateCSSUnit(iconTextGap, "px")
Expand All @@ -145,7 +153,7 @@
"padding": `${generateCSSUnit(blockTopPaddingMobile, "px")} ${generateCSSUnit(blockRightPaddingMobile, "px")} ${generateCSSUnit(blockBottomPaddingMobile, "px")} ${generateCSSUnit(blockLeftPaddingMobile, "px")}`,
},
" .responsive-block-editor-addons-call-mail-button-button-container": {
"width": buttonWidthMobileCSS,
"width": inheritFromTheme ? '' : buttonWidthMobileCSS,
},
" .responsive-block-editor-addons-call-mail-button-text": {
"font-size": `${generateCSSUnit(textFontSizeMobile, "px")} !important`,
Expand All @@ -169,7 +177,7 @@
"padding": `${generateCSSUnit(blockTopPaddingTablet, "px")} ${generateCSSUnit(blockRightPaddingTablet, "px")} ${generateCSSUnit(blockBottomPaddingTablet, "px")} ${generateCSSUnit(blockLeftPaddingTablet, "px")}`,
},
" .responsive-block-editor-addons-call-mail-button-button-container": {
"width": buttonWidthTabletCSS,
"width": inheritFromTheme ? '' : buttonWidthTabletCSS,
},
" .responsive-block-editor-addons-call-mail-button-text": {
"font-size": `${generateCSSUnit(textFontSizeTablet, "px")} !important`,
Expand Down
Loading
Loading