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

Fixed icon not rotated and simplified component #15350

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

marcusmoore
Copy link
Collaborator

Description

This PR builds on #15327 and simplifies the icon component by relying on the behavior of rendering {{ $attributes }} within a component. This allows any native html attributes to be rendered on the component by passing them in (<x-icon something="here") and utilizing the {{ $attributes }} that is already rendered in the component.

The removal of id from the props is especially helpful since it allows it to be rendered when $attributes is used within the component and fixes an issue where a couple icons weren't rotating any more since id was no longer being added:

Before After
Icon not rotating Icon rotates

In other words, by including id in props we would have had to manually write {{ $id }} within the component's i tag to get it to render.

Another potential (minor) change would be to not set a default value for title in props since it should always be passed in but I'll skip that in this PR to avoid re-testing all views.

Type of change

  • Bug fix (ish)

Copy link

what-the-diff bot commented Aug 20, 2024

PR Summary

  • Optimizations to icon.blade.php
    The existing code in icon.blade.php which controls the various design aspects of icons was streamlined. Unnecessary properties and attributes like class style, id, and title were removed from the file. Also, the 'merge function', which is used to combine properties, was refined to act specifically only on the 'class' attribute. This leads to a more optimized and clutter-free code, resulting in better performance.

@snipe snipe merged commit 22d3734 into snipe:develop Aug 20, 2024
8 of 9 checks passed
@marcusmoore marcusmoore deleted the icon-component-updates branch August 20, 2024 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants