-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
add AppCard component #784
Conversation
🦋 Changeset detectedLatest commit: 7bf7d7e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for modest-rosalind-098b67 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for asyncapi-studio-design-system ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Lovely! Looks like in the design 🚀
Just left some comments.
@fmvilas another round of review 🙇 |
@fmvilas done. but left the space between client/server badge and protocol badges to keep them separated. |
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.
LGTM
/au |
f0e8194
to
a590b21
Compare
99e267e
to
a590b21
Compare
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.
Great work @KhudaDad414! 🚀 Just a few suggestions to consider.
packages/ui/components/AppCard.tsx
Outdated
{isServer && <ServiceInfoBadge info='server'/>} | ||
</div> | ||
} | ||
{badges.map((badge, index) => (<ServiceInfoBadge info={badge} key={index} />))} |
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.
{badges.map((badge, index) => (<ServiceInfoBadge info={badge} key={index} />))} | |
{Array.from(new Set(badges)) | |
.filter(badge => validBadges.includes(badge)) | |
.map((badge, index) => (<ServiceInfoBadge info={badge} key={`${badge}-${index}`} />))} |
- I noticed that invalid badges leave a blank space (reserved for that invalid badge).
What do you think about adding a check for this also? If a badge is not valid, we could simply ignore it instead of reserving blank space.
For this, we need to add an export of the list of valid badges from ServiceInfoBadge
export const validBadges: Info[] = ['http', 'kafka', 'websocket', 'amqp', 'mqtt', 'googlepubsub', 'ibmmq', 'nats', 'pulsar', 'redis', 'sns', 'sqs', 'solace', 'stomp', 'client', 'server'];
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.
we are already marking it's type as Info[]
so it will give error in Typescript. so I am more in favour of letting typescript give the error.
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.
Sorry, I didn't get this, could you please explain that further.
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.
@princerajpoot20 I mean Typescript doesn't allow invalid badges:
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.
@KhudaDad414 Okay, got it. Makes sense. 👍
Co-authored-by: Prince Rajpoot <[email protected]>
Co-authored-by: Prince Rajpoot <[email protected]>
Co-authored-by: Prince Rajpoot <[email protected]>
packages/ui/components/AppCard.tsx
Outdated
{isServer && <ServiceInfoBadge info='server'/>} | ||
</div> | ||
} | ||
{Array.from(new Set(badges)).map((badge, index) => (<ServiceInfoBadge info={badge} key={badge + index} aria-label={`Badge for ${badge}`} />))} |
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.
I would extract this to a variable so it's easier to understand. Above the return
on line 14, I would add this:
const dedupedListOfBadges = Array.from(new Set(badges)).map((badge, index) => (<ServiceInfoBadge info={badge} key={badge + index} aria-label={`Badge for ${badge}`} />))
And then in this line I would just add {dedupedListOfBadges}
. The code would be much more readable IMHO.
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.
Also, for the aria-label
, this is what a screen reader would say so imagine having 4 or 5 badges. The screen reader would say: "Badge for client, Badge for server, Badge for websocket, Badge for HTTP, Badge for kafka" 😅 Badge badge badge 😂
I suggest that we improve the root element aria-label
with a better explanation and would mark all these badges with aria-hidden={true}
. This way we can create a meaningful sentence like "This application is both a server and a client. It uses the WebSocket, HTTP, and Kafka protocols".
{Array.from(new Set(badges)).map((badge, index) => (<ServiceInfoBadge info={badge} key={badge + index} aria-label={`Badge for ${badge}`} />))} | |
{Array.from(new Set(badges)).map((badge, index) => (<ServiceInfoBadge info={badge} key={badge + index} aria-hidden={true} />))} |
Then on line 17, we change it to:
aria-label={ariaLabel}
Where ariaLabel
is something like "{name}. This application is active/inactive, and it's both a server and a client. It uses the WebSocket, HTTP, and Kafka protocols."
Note we're missing the description though. I'm not sure if a screen reader would read the paragraph below because it's not focusable. We should add https://storybook.js.org/addons/addon-screen-reader to Storybook so we can properly test what our users will experience using a screen reader.
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.
I would extract this to a variable so it's easier to understand.
Agreed, extracting the badges list makes the code cleaner.
Also, for the aria-label, this is what a screen reader would say so imagine having 4 or 5 badges. The screen reader would say: "Badge for client, Badge for server, Badge for websocket, Badge for HTTP, Badge for kafka"
I see your point, and I agree. Right now, it is not a fit for 4-5 badges.
I suggest that we improve the root element aria-label with a better explanation and would mark all these badges with aria-hidden={true}. This way we can create a meaningful sentence like "This application is both a server and a client. It uses the WebSocket, HTTP, and Kafka protocols".
We should add https://storybook.js.org/addons/addon-screen-reader to Storybook so we can properly test what our users will experience using a screen reader.
Sounds perfect.
Co-authored-by: Fran Méndez <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
LGTM 👍
/rtm |
Description
Related issue(s)
fixes #749