Skip to content

Stop using font icon in section field icons in form builder#2146

Merged
Crabcyborg merged 11 commits into
masterfrom
issue-5504-stop_using_font_icon_in_section_field_icon
Dec 3, 2024
Merged

Stop using font icon in section field icons in form builder#2146
Crabcyborg merged 11 commits into
masterfrom
issue-5504-stop_using_font_icon_in_section_field_icon

Conversation

@AbdiTolesa
Copy link
Copy Markdown
Contributor

@AbdiTolesa AbdiTolesa commented Nov 29, 2024

@AbdiTolesa AbdiTolesa changed the title Issue 5504 stop using font icon in section field icon Stop using font icons in section field icon Nov 29, 2024
@AbdiTolesa AbdiTolesa changed the title Stop using font icons in section field icon Stop using font icon in section field icons in form builder Nov 29, 2024
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 29, 2024

Warning

Rate limit exceeded

@AbdiTolesa has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 3542f40 and b518285.

Walkthrough

The pull request introduces changes to the rendering logic and styling of form fields in the Formidable Forms admin interface. In add_field.php, enhancements for 'divider' fields include new icon calls and structural adjustments. The CSS file frm_admin.css undergoes extensive updates, including the introduction of new CSS variables, removal of deprecated ones, and refinements to styles for various UI components. These changes aim to modernize the design, improve usability, and ensure consistency across the interface.

Changes

File Path Change Summary
classes/views/frm-forms/add_field.php Added icon rendering and a new <div class="divider_section_only"> wrapper for 'divider' field types.
css/frm_admin.css Extensive styling updates including new CSS variables, removal of deprecated variables, and enhancements to component styles for improved UI.

Possibly related PRs

Suggested labels

run analysis, run tests

Suggested reviewers

  • Crabcyborg
  • shervElmi

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
classes/views/frm-forms/add_field.php (1)

Line range hint 7-103: Consider implementing a consistent icon system

Given the PR's objective to move away from font icons, consider implementing a more systematic approach:

  1. Create a centralized icon component/helper that supports multiple icon types (SVG, font, etc.)
  2. This would make it easier to transition away from font icons gradually
  3. Consider adding a configuration option to control the icon implementation type

Example approach:

// Icon helper that supports multiple types
FrmIconHelper::render('form-title-style', [
    'type' => 'svg', // or 'font' for backward compatibility
    'class' => 'your-classes'
]);

Would you like me to help draft a detailed proposal for this architectural improvement?

css/frm_admin.css (1)

6579-6587: Consider removing the redundant color property

In the selector .edit_field_type_divider .frmsvg, both fill and color properties are specified. Since fill is used to set the color of SVG content, the color property might be unnecessary unless it's intended for fallback or affecting non-SVG child elements. Removing redundant properties can simplify the code and improve maintainability.

Apply this diff to remove the unnecessary color property:

 .edit_field_type_divider .frmsvg {
     padding: 2px;
     position: absolute;
     left: -12px;
     fill: var(--primary-700);
-    color: #fff;
     background-color: var(--primary-700);
     border-radius: 50%;
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 77f88aa and 831715b.

📒 Files selected for processing (2)
  • classes/views/frm-forms/add_field.php (2 hunks)
  • css/frm_admin.css (1 hunks)
🔇 Additional comments (2)
classes/views/frm-forms/add_field.php (2)

103-103: Review implementation approach for icon replacement

Similar to the previous icon, this adds another font icon (frmfont frm-circle), which appears to contradict the goal of removing font icons from section fields.

Consider:

  1. Should these be replaced with SVG icons or another non-font icon approach?
  2. Is there a transition plan to move away from font icons?

Let's check for any existing SVG icon implementations that could be used instead:


7-9: Verify alignment with PR objectives

The addition of FrmAppHelper::icon_by_class('frmfont frm-form-title-style') appears to introduce a new font icon, which seems to contradict the PR objective of stopping the use of font icons in section field icons.

Let's check if there are any related icon implementations that might provide insight into the intended approach:

Comment thread css/frm_admin.css Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
css/frm_admin.css (1)

6589-6597: Consider using CSS custom properties for dimensions

While the styles for the start divider icon are functionally correct, consider extracting the hardcoded dimensions (8px, -4px, -24.5px) into CSS custom properties for better maintainability and consistency.

 .edit_field_type_divider .start_divider .frmsvg {
-    height: 8px;
-    width: 8px;
+    height: var(--divider-icon-size, 8px);
+    width: var(--divider-icon-size, 8px);
     padding: 0;
-    bottom: -4px;
-    left: -24.5px;
+    bottom: var(--divider-icon-offset-bottom, -4px);
+    left: var(--divider-icon-offset-left, -24.5px);
     color: var(--primary-700);
     background-color: #fff;
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 831715b and 3c74b13.

📒 Files selected for processing (1)
  • css/frm_admin.css (1 hunks)
🔇 Additional comments (2)
css/frm_admin.css (2)

6579-6587: LGTM: Base SVG icon styles for section dividers

The base styles for section divider icons are well-structured and use CSS custom properties consistently for colors. The absolute positioning and circular background create a clean visual indicator.


6598-6606: LGTM: Hover and selected states

The hover and selected states are well implemented, using the established color system and maintaining visual consistency with the interface.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
css/frm_admin.css (1)

6598-6606: Add transition for smoother hover effects

The hover state changes could benefit from a smooth transition effect.

Apply this diff:

 .edit_field_type_divider.selected .frmsvg,
 .edit_field_type_divider:hover .frmsvg {
     background: var(--primary-500);
+    transition: background-color 0.2s ease-out;
 }

 .edit_field_type_divider.selected .start_divider .frmsvg,
 .edit_field_type_divider:hover .start_divider .frmsvg {
     background-color: #fff;
-    color: var(--primary-500);
+    fill: var(--primary-500);
+    transition: fill 0.2s ease-out;
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3c74b13 and 18de8f9.

📒 Files selected for processing (1)
  • css/frm_admin.css (1 hunks)
🔇 Additional comments (2)
css/frm_admin.css (2)

6588-6596: 🛠️ Refactor suggestion

Previous suggestion for using fill still applies

The same issue exists in this selector where color is used instead of fill for SVG styling.

Apply this diff:

 .edit_field_type_divider .start_divider .frmsvg {
     height: 8px;
     width: 8px;
     padding: 0;
     bottom: -4px;
     left: -24.5px;
-    color: var(--primary-700);
+    fill: var(--primary-700);
     background-color: #fff;
 }

6579-6587: 🛠️ Refactor suggestion

Consider using fill instead of color for SVG icons

For SVG elements, the fill property is more appropriate than color for controlling the icon color. This ensures consistent rendering across browsers.

Apply this diff:

 .edit_field_type_divider .frmsvg {
     padding: 2px;
     position: absolute;
     left: -12px;
-    color: #fff;
+    fill: #fff;
     background-color: var(--primary-700);
     border-radius: 50%;
 }

Likely invalid or redundant comment.

Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg left a comment

Choose a reason for hiding this comment

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

@AbdiTolesa It looks like this update causes a lot of issues with other icons inside of sections. The move field icon, the more options dropdown, the option in that dropdown, etc.

Screen Shot 2024-11-29 at 9 07 20 AM Screen Shot 2024-11-29 at 9 07 29 AM

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
css/frm_admin.css (1)

6588-6596: Consider using CSS custom properties for magic numbers

While the styles are generally good, consider extracting magic numbers like 8px, 4px, -24.5px into CSS custom properties for better maintainability.

 .edit_field_type_divider .start_divider .frm-divider-icon.frmsvg {
-    height: 8px;
-    width: 8px;
+    height: var(--divider-icon-size, 8px);
+    width: var(--divider-icon-size, 8px);
     padding: 0;
     bottom: -4px;
-    left: -24.5px;
+    left: var(--divider-icon-offset, -24.5px);
     color: var(--primary-700);
     background-color: #fff;
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 18de8f9 and 3542f40.

📒 Files selected for processing (2)
  • classes/views/frm-forms/add_field.php (2 hunks)
  • css/frm_admin.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • classes/views/frm-forms/add_field.php
🔇 Additional comments (2)
css/frm_admin.css (2)

6579-6587: LGTM: Base divider icon styles are well structured

The base styles for the divider icon are well implemented with:

  • Proper use of CSS variables for colors and consistent theming
  • Good positioning with absolute positioning
  • Appropriate use of transitions for hover states

6598-6606: LGTM: Hover and selected states are properly handled

The hover and selected states are well implemented:

  • Consistent use of CSS variables for colors
  • Proper specificity in selectors
  • Good separation of concerns between states

Comment thread css/frm_admin.css Outdated
@AbdiTolesa AbdiTolesa requested a review from Crabcyborg December 3, 2024 11:04
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg left a comment

Choose a reason for hiding this comment

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

Thanks @AbdiTolesa!

I think this is good to merge now.

🚀

@Crabcyborg Crabcyborg merged commit 34bb8b8 into master Dec 3, 2024
@Crabcyborg Crabcyborg deleted the issue-5504-stop_using_font_icon_in_section_field_icon branch December 3, 2024 13:24
@Crabcyborg
Copy link
Copy Markdown
Contributor

Crabcyborg commented Dec 3, 2024

@AbdiTolesa It looks like I merged a bit early.

I forgot that this update would also impact repeaters. Can you get it looking like it did before?

Now it shows the H, and the repeater icon is floating outside of the circle.

Before this update
Screen Shot 2024-12-03 at 9 26 52 AM

After this update
Screen Shot 2024-12-03 at 9 27 54 AM

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants