-
Notifications
You must be signed in to change notification settings - Fork 100
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
Conversation
There was a problem hiding this 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.
web/app/components/doc/thumbnail.ts
Outdated
@@ -20,6 +25,14 @@ export default class DocThumbnailComponent extends Component<DocThumbnailCompone | |||
} | |||
} | |||
|
|||
protected get productAvatarSize() { |
There was a problem hiding this comment.
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?
private get sizeIsMedium() { | ||
return this.args.size === HermesAvatarSize.Medium; | ||
} | ||
|
||
private get sizeIsLarge() { | ||
return this.args.size === HermesAvatarSize.Large; | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, sounds good 👍
Pending #385 #387
Component-izes the "product badge" (renamed to ProductAvatar). We'll soon expand this to handle products without FlightIcons.