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

♻️ Refactor the tabs component to be reused #113

Merged
merged 3 commits into from
May 15, 2024
Merged

Conversation

foysalit
Copy link
Contributor

@foysalit foysalit commented May 3, 2024

This is a simple refactor of the existing tabs components that was just copy pasted across various pages.

Copy link

render bot commented May 3, 2024

Copy link

render bot commented May 3, 2024

if (item.serviceAccountOnly && !isServiceAccount) {
return
}
const Icon = ICONS[item.icon]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this end up showing the "Configure" nav item to non-service accounts? The main issue there is that only the service account has the ability to modify their service record, so it wont have the intended effect if another user does it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(There's also similar logic in SidebarNav.tsx)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh this wasn't meant to be committed. cleaned up.

Comment on lines 18 to 22
const Tab = ({
view,
label,
sublabel,
}: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Defining a component anonymously like this has a quirk, which is that it always fully unmounts and remounts on render. I'd recommend just pulling this out into its own component outside of Tabs render function.

Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

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

Nice!

@foysalit foysalit merged commit 7338766 into main May 15, 2024
3 checks passed
@matthieusieben matthieusieben deleted the tabs-refactor branch November 15, 2024 14:55
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