Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak: Button icon constrols #27296

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

hein-obox
Copy link
Member

PR Checklist

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Summary

This PR can be summarized in the following changelog entry:

Description

An explanation of what is done in this PR

Test instructions

This PR can be tested by following these steps:

Quality assurance

  • I have tested this code to the best of my abilities
  • I have added unittests to verify the code works as intended
  • Docs have been added / updated (for bug fixes / features)

Fixes #

Mchris-hub and others added 30 commits April 18, 2024 19:46
…hub/elementor into christian/button-styling

# Conflicts:
#	modules/apps/admin-apps-page.php
svg {
width: 1em;
height: auto;
// Display: flex; // This seems to be causing Backwards Compatibility issues.
Copy link
Member Author

@hein-obox hein-obox May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing tests break when this styling is used.

I have updated this.

@@ -83,6 +93,21 @@

span {
text-decoration: inherit; //fix for conflict with text-decoration & inline-block
// Align-self: center; // This might be causing a Backwards Compatibility issue.
Copy link
Member Author

@hein-obox hein-obox May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing tests break when this styling is used.

I have updated this.

'selectors_dictionary' => [
'left' => is_rtl() ? 'row-reverse' : 'row',
'right' => is_rtl() ? 'row' : 'row-reverse',
'above' => is_rtl() ? 'column-reverse' : 'column',
Copy link
Member Author

@hein-obox hein-obox May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vertical direction doesn't change on an rtl screen.

And I have added the flex/align-self styling to the new control options only, to ensure that the existing styling doesn't change:

Suggested change
'above' => is_rtl() ? 'column-reverse' : 'column',
'above' => '--button-flex-direction: column; --button-icon-display: flex; --button-align-self: center;',

'left' => is_rtl() ? 'row-reverse' : 'row',
'right' => is_rtl() ? 'row' : 'row-reverse',
'above' => is_rtl() ? 'column-reverse' : 'column',
'below' => is_rtl() ? 'column' : 'column-reverse',
Copy link
Member Author

@hein-obox hein-obox May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'below' => is_rtl() ? 'column' : 'column-reverse',
'below' => '--button-flex-direction: column-reverse; --button-icon-display: flex; --button-align-self: center;',

],
],
'selectors_dictionary' => [
'left' => is_rtl() ? 'row-reverse' : 'row',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'left' => is_rtl() ? 'row-reverse' : 'row',
'left' => is_rtl() ? '--button-flex-direction: row-reverse' : '--button-flex-direction: row',

],
'selectors_dictionary' => [
'left' => is_rtl() ? 'row-reverse' : 'row',
'right' => is_rtl() ? 'row' : 'row-reverse',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'right' => is_rtl() ? 'row' : 'row-reverse',
'right' => is_rtl() ? '--button-flex-direction: row' : '--button-flex-direction: row-reverse',

'below' => is_rtl() ? 'column' : 'column-reverse',
],
'selectors' => [
'{{WRAPPER}} .elementor-button-content-wrapper' => 'flex-direction: {{VALUE}};',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This styling can be updated inside SCSS:

Suggested change
'{{WRAPPER}} .elementor-button-content-wrapper' => 'flex-direction: {{VALUE}};',
'{{WRAPPER}}' => '{{VALUE}};',

'selectors_dictionary' => [
'row' => is_rtl() ? '--button-flex-direction: row-reverse' : '--button-flex-direction: row',
'row-reverse' => is_rtl() ? '--button-flex-direction: row' : '--button-flex-direction: row-reverse',
'column' => '--button-flex-direction: column; --button-align-self: center; --button-icon-display: flex;',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated this.

  1. RTL means 'from right to left'. That doesn't have an impact on the vertical styling (Above / Below)
  2. You use the 'above' and 'below' values inside the dictionary, while you added 'column' and 'column-reverse' inside the control.
  3. I have updated the align-self and display styling, for when users use the new control values. The old control values will stay as it was.

[
'label' => esc_html__( 'Size', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'range' => [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This range values can be deleted, because these are the default values.

],
'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ],
'selectors' => [
'{{WRAPPER}}' => '--button-icon-size: {{SIZE}}{{UNIT}}; --button-icon-display: flex; --button-align-self: center;',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the new display and align self styling here.
If the user leaves the icon size control empty, then we will keep the original styling.

],
],
'selectors_dictionary' => [
'left' => is_rtl() ? 'row-reverse' : 'row',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These dictionary values where used because the old controls where updated. We can't remove them. I believe that you triggered had changed them to 'row' and 'row-reverse', but we need to keep the original once as well.

And there is no need for an rtl conversion inside the row/row-reverse settings.

]
),
]
);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two empty lines here.

'selectors' => [
'{{WRAPPER}}' => '--button-icon-size: {{SIZE}}{{UNIT}}; --button-icon-display: flex; --button-align-self: center;',
],
]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tabs must be used to indent lines; spaces are not
| | allowed

$this->start_controls_tab(
'icon_button_normal',
[
'label' => esc_html__( 'Normal', 'elementor' ),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove spaces and replace with tabs.

'icon_button_normal',
[
'label' => esc_html__( 'Normal', 'elementor' ),
'condition' => $args['section_condition'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tabs instead of spaces.

[
'label' => esc_html__( 'Normal', 'elementor' ),
'condition' => $args['section_condition'],
]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tabs instead of spaces.

'selectors' => [
'{{WRAPPER}}' => '--button-icon-color: {{VALUE}};',
],
]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tab too much.

[
'label' => esc_html__( 'Hover', 'elementor' ),
'condition' => $args['section_condition'],
]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tab too much.

'label' => esc_html__( 'Hover', 'elementor' ),
'condition' => $args['section_condition'],
]
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tab too much.

'selectors' => [
'{{WRAPPER}}' => '--button-icon-color-hover: {{VALUE}};',
],
]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tab too much.

@hein-obox hein-obox force-pushed the christian/button-styling branch 2 times, most recently from 459a21d to e2a2ac4 Compare May 20, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants