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

chore: adds XAction component #2273

Merged
merged 1 commit into from
Mar 28, 2024
Merged

Conversation

johncowen
Copy link
Contributor

@johncowen johncowen commented Mar 6, 2024

Another little PR I had in mind whilst I'm awaiting reviews of others:

Adds an eXtra eXtension to RouterLink in the form of an XAction component which can be used instead of RouterLink (we can eventually take that out of the global scope)

Mainly to paper over the awkward inactive: route.params.inactive ? null : undefined things (I included one example of this here) which really should just be inactive: true | false. But also adds dynamic node choosing based on existence href/to properties and I'm sure there'll be more things we might want to add here in future.

Copy link

netlify bot commented Mar 6, 2024

Deploy Preview for kuma-gui ready!

Name Link
🔨 Latest commit 36a46ca
🔍 Latest deploy log https://app.netlify.com/sites/kuma-gui/deploys/66058aff7679f3000811cd04
😎 Deploy Preview https://deploy-preview-2273--kuma-gui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@johncowen johncowen self-assigned this Mar 6, 2024
@johncowen johncowen marked this pull request as ready for review March 6, 2024 14:27
@johncowen johncowen requested a review from a team as a code owner March 6, 2024 14:27
@johncowen johncowen requested review from kleinfreund and removed request for a team March 6, 2024 14:27
@slonka
Copy link
Contributor

slonka commented Mar 28, 2024

@johncowen same as the other PR - anything we can help with?

@johncowen
Copy link
Contributor Author

Yep defo, feel free to review if you're ok with that. This one is pretty straight forwards codewise I think. The majority of it is converting true/false to null / undefined but instead of doing that in the application code we hide it away in a component.

Separately, there is also code to decide whether to use a <a> or a <button> depending on whether you have passed a href/to or not. If we have a URL/href the element should always be a <a> if we dont' it should always be a <button>. Again we hide this away behind a <XAction /> component so as an application dev I don't need to think about it, or potentially get that wrong.

We do this conversion so we get /url?inactive and /url instead of /url?inactive=true and /url?inactive=false in the browser location bar.

Let me know if there is anything else I can help with

(oh also if its better to rebase these before review lemme know, I usually leave them until during or after review to avoid rebasing everyday as the days go by with these PRs sitting here)

Signed-off-by: John Cowen <john.cowen@konghq.com>
@johncowen
Copy link
Contributor Author

ty! This one needed a rebase, so I'll leave hanging for a little while incase, but then go ahead and merge

@johncowen johncowen merged commit 32a1f90 into kumahq:master Mar 28, 2024
15 checks passed
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.

3 participants