Repository navigation
refactor: update AppNav to use click-ui badges #3378
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@hyperdx/app': patch | ||
| --- | ||
|
|
||
| feat: use the click-ui `Badge` for the sidebar "Beta", "UTC", and instance | ||
| label badges, and for the "Latest", "New", and "Breaking" badges in What's new. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/app/src/components/AppNav/__tests__/WhatsNewHighlightRow.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { screen } from '@testing-library/react'; | ||
|
|
||
| import { WhatsNewHighlightRow } from '@/components/AppNav/WhatsNewHighlightRow'; | ||
|
|
||
| // click-ui encodes state only in hashed CSS module class names, so the mock | ||
| // exposes the props as attributes to assert on. | ||
| jest.mock('@clickhouse/click-ui', () => ({ | ||
| ...jest.requireActual('@clickhouse/click-ui'), | ||
| Badge: ({ text, state }: { text: React.ReactNode; state?: string }) => ( | ||
| <span data-testid="badge" data-state={state}> | ||
| {text} | ||
| </span> | ||
| ), | ||
| })); | ||
|
|
||
| describe('WhatsNewHighlightRow', () => { | ||
| it.each([ | ||
| ['breaking', 'Breaking', 'danger'], | ||
| ['feature', 'New', 'info'], | ||
| ] as const)( | ||
| 'renders a %s headline with the %s badge', | ||
| (kind, label, state) => { | ||
| renderWithMantine( | ||
| <WhatsNewHighlightRow headline={{ kind, text: 'A headline' }} />, | ||
| ); | ||
|
|
||
| const badge = screen.getByTestId('badge'); | ||
| expect(badge).toHaveTextContent(label); | ||
| expect(badge).toHaveAttribute('data-state', state); | ||
| expect(screen.getByTestId('whats-new-headline')).toHaveTextContent( | ||
| 'A headline', | ||
| ); | ||
| }, | ||
| ); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🔵 minor — Small component now mixes click-ui and Mantine, against the Click UI convention
WhatsNewHighlightRow is about 20 lines and now renders a click-ui
Badgeinside MantineGroup/Box/Text. The Click UI section of the repository conventions says: "Do not: Mix both libraries inside one small component". Fix: move the rest of the row to click-ui as well (Textexists there, andContainercan replace theGroup, set up to match the current layout as that section describes), or keep the MantineBadgein this row until the whole row is migrated.Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond