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

Create Product::Avatar component #394

Merged
merged 15 commits into from
Oct 31, 2023
Merged

Create Product::Avatar component #394

merged 15 commits into from
Oct 31, 2023

Conversation

jeffdaley
Copy link
Contributor

Pending #385 #387

Component-izes the "product badge" (renamed to ProductAvatar). We'll soon expand this to handle products without FlightIcons.

@jeffdaley jeffdaley marked this pull request as ready for review October 27, 2023 17:26
@jeffdaley jeffdaley requested a review from a team as a code owner October 27, 2023 17:26
Copy link
Collaborator

@jfreda jfreda left a comment

Choose a reason for hiding this comment

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

Overall looks good, just couple of questions about the pattern for preferring boolean getters so I can understand better.

@@ -20,6 +25,14 @@ export default class DocThumbnailComponent extends Component<DocThumbnailCompone
}
}

protected get productAvatarSize() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need sizeIsLarge() with this?

Comment on lines 29 to 35
private get sizeIsMedium() {
return this.args.size === HermesAvatarSize.Medium;
}

private get sizeIsLarge() {
return this.args.size === HermesAvatarSize.Large;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious about this pattern vs. checking the value in the template using a more generic getter that just returns the size (like was added in the thumbnail component in this PR) - seems like that could be more scalable?

Copy link
Contributor Author

@jeffdaley jeffdaley Oct 30, 2023

Choose a reason for hiding this comment

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

Most of it was the convenience of having everything in one file in the early phase. But it's worth noting that Tailwind's dynamic class rules limit our efficiency a bit.* Still, we're past the early phase, so we can be smarter here. I refactored to use CSS classes.

* Of course, there are workarounds. I think safe-listing the w- and h- classes would allow us to do stuff like class="h-{{this.size}}" if that were ever preferable to CSS.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool, sounds good 👍

@jeffdaley jeffdaley merged commit 0a7d09d into main Oct 31, 2023
1 check passed
@jeffdaley jeffdaley deleted the jeffdaley/product-avatar-2 branch October 31, 2023 20:44
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.

2 participants