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(Range): new component #290

Merged
merged 22 commits into from
Jun 20, 2023
Merged

Conversation

TomSmith27
Copy link
Contributor

@TomSmith27 TomSmith27 commented Jun 14, 2023

Resolves #175

I saw that in #175 there was a feature request for a slider component, and i am looking to use NuxtLabs in an upcoming project, and i will need the slider. Can you let me know if this is the kind of component you are looking for, Its copied from DaisyUI https://daisyui.com/components/range/ with some tweaks to make it work in NuxtLabs.

The code is not finished but i wanted to check before tidying it all up

  1. This style of component is what you are looking for
  2. The way i have implemented it is correct

@benjamincanac I believe you will be the best person to look at this

@vercel
Copy link

vercel bot commented Jun 14, 2023

Someone is attempting to deploy a commit to the Nuxt Labs Team on Vercel.

A member of the Team first needs to authorize it.

@nuxt-studio
Copy link

nuxt-studio bot commented Jun 14, 2023

Live Preview ready!

Name Edit Preview Latest Commit
ui Edit on Studio ↗︎ View Live Preview d5662fa

@nuxt-studio-dev
Copy link

Live Preview ready!

Name Edit Preview Latest Commit
ui Edit on Studio ↗︎ View Live Preview 7d86f39

Copy link
Member

Hello @TomSmith27,

Thank you for starting this component! For the styling, I would prefer something like https://ui.shadcn.com/docs/components/slider with a touch of primary color, similar to the Toggle component.

Also, all the styles should be defined in the app.config.ts and not under <style> so it can be fully customizable.

Let me know when you're close, I'll tweak the styles if needed to keep consistency between all the components 😊

Copy link
Member

I'm wondering if it wouldn't be better to rename the component to Range as it's the name of the input type similar to checkbox and radio. Also, adding min, max and step as prop would might be worth since these are specific to range type.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#additional_attributes

Copy link
Member

For the styling, it might be easier to style it with appearance-none, here is an example: https://tailwind-elements.com/docs/standard/forms/range/

@TomSmith27
Copy link
Contributor Author

TomSmith27 commented Jun 15, 2023

I'm wondering if it wouldn't be better to rename the component to Range as it's the name of the input type similar to checkbox and radio. Also, adding min, max and step as prop would might be worth since these are specific to range type.

Yep, i was planning to add those, was just wanting to make sure you still wanted this before doing the extra bits.

@TomSmith27
Copy link
Contributor Author

Hello @TomSmith27,

Thank you for starting this component! For the styling, I would prefer something like ui.shadcn.com/docs/components/slider with a touch of primary color, similar to the Toggle component.

Also, all the styles should be defined in the app.config.ts and not under <style> so it can be fully customizable.

Let me know when you're close, I'll tweak the styles if needed to keep consistency between all the components 😊

I also like the shadcn version so i will attempt to style it like that

Comment on lines 33 to 34
type: [String, Number],
default: ''
Copy link
Contributor

@Haythamasalama Haythamasalama Jun 15, 2023

Choose a reason for hiding this comment

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

I think modelValue should be a Number with a default value of 0, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep have fixed

@benjamincanac benjamincanac marked this pull request as draft June 15, 2023 14:38
@TomSmith27 TomSmith27 changed the title fixes #175 proof of concept for Slider component from daisyUI fixes #175 Range input based onhttps://www.material-tailwind.com/docs/react/slider Jun 15, 2023
@TomSmith27
Copy link
Contributor Author

I have now updated it to be based on this design https://www.material-tailwind.com/docs/react/slider, let me know your thoughts

Thanks :)

@TomSmith27 TomSmith27 marked this pull request as ready for review June 15, 2023 22:15
@benjamincanac benjamincanac changed the title fixes #175 Range input based onhttps://www.material-tailwind.com/docs/react/slider feat(Range): new component Jun 16, 2023
@vercel
Copy link

vercel bot commented Jun 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview Jun 20, 2023 1:03pm

@benjamincanac
Copy link
Member

I've just made some updates to your component, let me know what you think 😊

Copy link
Member

On Firefox, the component will display different as z-index doesn't seem to work on -moz-range-thumb:
CleanShot 2023-06-20 at 15.31.11@2x.png
CleanShot 2023-06-20 at 15.32.16@2x.png

.prettierrc.json Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the UI does not use a prettier, it uses Eslint ?

Copy link
Member

Choose a reason for hiding this comment

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

I guess we can let it inside the project, so people who have the Prettier extension on VSCode can contribute easily?

@benjamincanac benjamincanac merged commit 34a4c41 into nuxt:dev Jun 20, 2023
@TomSmith27
Copy link
Contributor Author

I've just made some updates to your component, let me know what you think 😊

Yep all looks great thanks for taking the time to review it!

benjamincanac added a commit that referenced this pull request Jun 21, 2023
Co-authored-by: Tom Smith <tom.smith2711@gmail.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
Co-authored-by: Tom Smith <tom.smith@qunifi.com>
benjamincanac added a commit that referenced this pull request Jun 21, 2023
Co-authored-by: Tom Smith <tom.smith2711@gmail.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
Co-authored-by: Tom Smith <tom.smith@qunifi.com>
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.

[Forms] Range
3 participants