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

[Experimental] Add icon components #487

Merged
merged 1 commit into from
Mar 25, 2024
Merged

[Experimental] Add icon components #487

merged 1 commit into from
Mar 25, 2024

Conversation

Windvis
Copy link
Contributor

@Windvis Windvis commented Mar 25, 2024

Note

This is a recreation of #483 to fix the git history.

This adds icon components for each .svg file in the /public/icons folder. We don't register them in the global component namespace, to use them you need to import them in your JS files and pass them through the template context. This a lot more intuitive in the .gjs world, but it still works in loose-mode as well, but it is more verbose.

This PR isn't very useful by itself, but together with #481 it can be used to replace the string based icon setup.

Warning

This setup is still in an experimental state. We want to try it out in a couple of specific places before considering this ready to use by all the Appuniversum users. We might still break the setup in future minor versions until we announce it as stable.

Usage examples

(These examples assume #481 is merged)

Polaris

// some-delete-button.gjs
import { BinIcon } from '@appuniversum/ember-appuniversum/components/icons/bin';
import AuButton from '@appuniversum/ember-appuniversum/components/au-button';

<template>
  <AuButton
    @icon={{BinIcon}}
    @alert={{true}}
  >
    Delete something
  </AuButton>
</template>

Octane

// some-delete-button.js
import { BinIcon } from '@appuniversum/ember-appuniversum/components/icons/bin';
import Component from '@glimmer/component';

export default class SomeDeleteButton extends Component {
  BinIcon = BinIcon;
}
{{! some-delete-button.hbs}}
<AuButton
  @icon={{this.BinIcon}}
  @alert={{true}}
>
  Delete something
</AuButton>

Part of the solution for #482

This adds a script that can generate .gts components from the .svg icons
in the public folder. This setup saves us a lot of manual work and it
easily allows us to manage the icons we bundle.
@Windvis Windvis changed the title Add icon components [Experimental] Add icon components Mar 25, 2024
@Windvis Windvis added the enhancement Used when the PR adds a new feature or enhancement. label Mar 25, 2024
@Windvis Windvis merged commit 0791d7a into master Mar 25, 2024
8 checks passed
@Windvis Windvis deleted the icon-components branch March 25, 2024 11:55
@Windvis Windvis mentioned this pull request Mar 25, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Used when the PR adds a new feature or enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant