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

feat(Ladder): new component #976

Closed
wants to merge 10 commits into from

Conversation

DarkGhostHunter
Copy link
Contributor

@DarkGhostHunter DarkGhostHunter commented Nov 16, 2023

πŸ”— Linked issue

Resolves #180

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

image

This is my interpretation of #549. While is not that simplier like the aforementioned, it's more flexible in design:

  • Labels are below the indicator icon
  • Separators can be disabled
  • Supports click and navigation.
  • Steps can be enabled to receive click-to-change.
  • Multiple color combinations

While I tried to make it vertically compatible, it's impossible without making spaghetti code to support both orientations. Instead, we should grab inspiration from Tailwind UI Feeds.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

vercel bot commented Nov 16, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
ui ❌ Failed (Inspect) Dec 28, 2023 4:52pm

@benjamincanac
Copy link
Member

benjamincanac commented Dec 26, 2023

@DarkGhostHunter Thanks for this PR! Don't you think it would be better to call this component USteps?

@benjamincanac
Copy link
Member

Also, would it make sense to support links?

@DarkGhostHunter
Copy link
Contributor Author

@DarkGhostHunter Thanks for this PR! Don't you think it would be better to call this component USteps?

Yep, that's okay.

I thought of a ULadder because you go up and down step by step. Also UStairs for the same reason.

Also, would it make sense to support links?

Well, it does with to, but only if you click the icon.

Its tricky to support links because the link would:

  • comprise the whole step, including the separators,
  • or apply both link elements to the icon and label separately.

So I went with the easy route only supporting the click on the icon. Now that you mention it, I should add a hover effect.

As previous attempts show, creating this type of element is tricky and doesn't come without its own limitations and issues, primarily because the design of the step and the separators themselves. Some concessions on functionality and design must be made to avoid unwanted or shallow behavior.

Copy link
Member

I've encountered this issue on the Breadcrumb component and added the divider outside of the link: https://github.com/nuxt/ui/blob/dev/src/runtime/components/navigation/Breadcrumb.vue#L24

Copy link
Member

Also, it would be nice to move this component to the Navigation category 😊

type: Array as PropType<String[] | LadderStep[]>,
default: () => []
},
separators: {
Copy link
Member

Choose a reason for hiding this comment

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

Could be nice to call this divider for consistency.

type: Number,
default: 0
},
steps: {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can call this items like in Feed?

return [...appConfig.ui.colors, 'gray'].includes(value)
}
},
click: {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be handled in items directly and emit a click instead of using a prop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You know? You're right if you think that the normal implementation for this would be to not have any click behavior and let the changes be done outside, like a form.

I just thought that it would be faster to implement a way to let the dev handle the click for changing steps in one variable rather than adding the handler on each item.

Can I set then the change-on-click prop to add a default click handler to all items to change to that step when clicked?

@DarkGhostHunter
Copy link
Contributor Author

I've encountered this issue on the Breadcrumb component and added the divider outside of the link: https://github.com/nuxt/ui/blob/dev/src/runtime/components/navigation/Breadcrumb.vue#L24

Yeah, but here the separstor would be tricky to put unless...

...we add four separators. Two each side of the icon, and two each side of the whole step. This way the looks like the separators are one.

To align them, we should use a 3x2 CSS grid instead, that way the separators on the top can be naturally aligned in the center of the first row, where the icon is.

Also, it would be nice to move this component to the Navigation category 😊

Go ahead.

@benjamincanac
Copy link
Member

@DarkGhostHunter Do you plan to keep working this PR or should I take over?

@DarkGhostHunter
Copy link
Contributor Author

You may take over. The time I had left to work on it is gone πŸ˜₯

@uricholiveira
Copy link

Any news?

@benjamincanac benjamincanac marked this pull request as draft February 7, 2024 14:17
Copy link

EvanSchleret commented Apr 5, 2024

Hey ! Is there any news on this PR ? Thanks :)

Copy link
Member

I haven't found the time to finish this unfortunately. I think this will be dropped and implemented in v3 (#1289) later on as a feature request has been opened in Radix Vue: unovue/radix-vue#805.

@DarkGhostHunter
Copy link
Contributor Author

I haven't found the time to finish this unfortunately. I think this will be dropped and implemented in v3 (#1289) later on as a feature request has been opened in Radix Vue: radix-vue/radix-vue#805.

Me neither. I have some nitpicks about the implementation, but either way it's better to wait for radix, or push a PR there.

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.

[Stepper] Implement component
5 participants