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

Move theming support from Beta to Main #129

Closed
wants to merge 0 commits into from
Closed

Move theming support from Beta to Main #129

wants to merge 0 commits into from

Conversation

jordanjones243
Copy link
Contributor

@jordanjones243 jordanjones243 commented Aug 16, 2024

Alaska Airlines Pull Request

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Resolves: #112

Summary:

Please summarize the scope of the changes you have submitted, what the intent of the work is and anything that describes the before/after state of the project.

Type of change:

Please delete options that are not relevant.

  • New capability
  • Revision of an existing capability
  • Infrastructure change (automation, etc.)
  • Other (please elaborate)

Checklist:

  • My update follows the CONTRIBUTING guidelines of this project
  • I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!

-- Auro Design System Team

Summary by Sourcery

Move theming support from Beta to Main by introducing custom SVG support, adding new icon styles, and updating documentation and tests accordingly.

New Features:

  • Introduce support for custom SVG icons using the customSvg attribute, allowing users to render any SVG content within the auro-icon component.

Enhancements:

  • Add new icon styles including info, secondary, subtle, and tertiary to provide more styling options for icons.
  • Deprecate the primary icon style in favor of more specific style options.

Documentation:

  • Update documentation to include examples and usage of the new customSvg attribute and additional icon styles.
  • Revise documentation to reflect the deprecation of the primary icon style.

Tests:

  • Add tests to verify the registration of auro-icon as a custom element with a custom name.
  • Remove outdated tests related to the advisory style and update tests to reflect new icon styles.

@jordanjones243 jordanjones243 self-assigned this Aug 16, 2024
@jordanjones243 jordanjones243 requested a review from a team as a code owner August 16, 2024 15:12
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ jason-capsule42
❌ semantic-release-bot
You have signed the CLA already but the status is still pending? Let us recheck it.

@jordanjones243 jordanjones243 linked an issue Aug 16, 2024 that may be closed by this pull request
2 tasks
Copy link

sourcery-ai bot commented Aug 16, 2024

Reviewer's Guide by Sourcery

This pull request updates the auro-icon component to support theming and introduces several new features and changes. The main changes include:

  1. Added support for custom SVG icons
  2. Introduced new color variants (info, secondary, tertiary, subtle)
  3. Deprecated the 'primary' attribute
  4. Removed the 'advisory' attribute (replaced by 'warning')
  5. Updated the styling to use CSS custom properties for better theming support
  6. Refactored the component to improve customization and flexibility
  7. Updated documentation and examples to reflect the new changes
  8. Added new tests for the new features

The implementation focuses on enhancing the component's flexibility and aligning it with the latest design system guidelines.

File-Level Changes

Files Changes
src/auro-icon.js
demo/api.md
apiExamples/customSvg.html
Added support for custom SVG icons using the 'customSvg' attribute
src/auro-icon.js
src/color.scss
apiExamples/visualState.html
apiExamples/onDark.html
Introduced new color variants: info, secondary, tertiary, and subtle
src/auro-icon.js
docs/api.md
Deprecated the 'primary' attribute and removed the 'advisory' attribute
src/color.scss
src/tokens.scss
src/style.scss
Updated styling to use CSS custom properties for better theming support
src/auro-icon.js
src/baseIcon.js
Refactored the component to improve customization and flexibility
demo/api.md
docs/api.md
README.md
CHANGELOG.md
Updated documentation and examples to reflect the new changes
test/auro-icon.test.js Added new tests for the new features and refactored existing tests
package.json
index.js
Updated build configuration and dependencies

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jordanjones243 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding performance benchmarks or optimization techniques for rendering multiple icons, especially with the new custom SVG support.
  • The deprecation of the primary attribute should be clearly communicated in the migration guide or release notes to help users update their implementations.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 3 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

expect(div).to.have.class('primary');
expect(div).to.have.class('emphasis');
expect(div).to.not.have.class('accent');
expect(div).to.not.have.class('disabled');
expect(nestedDiv).to.have.class('util_displayHiddenVisually');
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): Test case needs to be updated to reflect new component behavior

The test case title and assertions no longer match the component's behavior. The emphasis style and primary class checks have been removed. Consider updating the test to focus on the a11y div being hidden by default, which seems to be the main assertion left.

Suggested change
expect(nestedDiv).to.have.class('util_displayHiddenVisually');
it('auro-icon a11y div is hidden by default', async () => {
const el = await fixture(html`
<auro-icon category="interface" name="chevron-up"></auro-icon>
`);
await waitUntil(() => el.svg, 'Element did not become ready');
const nestedDiv = el.shadowRoot.querySelector('div > div');
expect(nestedDiv).to.have.class('util_displayHiddenVisually');
});

@@ -88,20 +90,15 @@ describe('auro-icon', () => {
expect(fetch).to.be.calledOnceWith(sinon.match('icons/interface/chevron-up.svg'));
});
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): Remove outdated test case for accent style

This test case is checking for styles that are no longer part of the component's behavior. Consider removing this test or updating it to check for the new styling approach.

await expect(el.localName).to.equal('custom-icon');

expect(el).to.have.attribute('auro-icon');
});
});
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): Add tests for new attributes and behaviors

Consider adding test cases for the newly introduced attributes such as 'customSvg', 'info', 'secondary', 'tertiary', and 'subtle'. Also, add tests to verify the behavior of the new slot for custom SVG content.

it('renders custom SVG content', async () => {
  const el = await fixture(html`
    <auro-icon>
      <svg slot="custom" viewBox="0 0 24 24"><path d="M12 2L2 22h20L12 2z"/></svg>
    </auro-icon>
  `);
  expect(el.shadowRoot.querySelector('slot[name="custom"]')).to.exist;
});

it('applies secondary style', async () => {
  const el = await fixture(html`<auro-icon category="interface" name="chevron-up" secondary></auro-icon>`);
  expect(el).to.have.attribute('secondary');
});

src/auro-icon.js Outdated
title="${ifDefined(this.title ? this.title : undefined)}"
>

title="${ifDefined(this.title ? this.title : undefined)}">
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Avoid unneeded ternary statements (simplify-ternary)

Suggested change
title="${ifDefined(this.title ? this.title : undefined)}">
title="${ifDefined(this.title || undefined)}">


ExplanationIt is possible to simplify certain ternary statements into either use of an || or !.
This makes the code easier to read, since there is no conditional logic.

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.

Update color tokens for theming support
3 participants