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

Generic components #39

Closed
gskorokhod opened this issue Sep 23, 2024 · 1 comment
Closed

Generic components #39

gskorokhod opened this issue Sep 23, 2024 · 1 comment

Comments

@gskorokhod
Copy link
Contributor

Now that we have the new data model with proper classes, we can significantly reduce code duplication for selector / badge components by writing them in a generic way.

As far as UI is concerned, we have the following kinds of objects:

  • Those with a name and an icon (Task, Skill, Shift)
  • Those with a name and an avatar (Person, Location)
  • Fallback: those that only have a name (Assignment?)

These can be represented as interfaces, and the components can be written like so:

<script lang="ts" generics="T extends HasAvatar">
    object: T | undefined = undefined;
    ...
</script>
@gskorokhod
Copy link
Contributor Author

Done in #38

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

No branches or pull requests

1 participant