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

Fix/range slider align #1222

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

revuwem
Copy link

@revuwem revuwem commented Jan 9, 2024

Removed field base wrapper from RangeSlider according to vanilla Flowbite range slider implementation to fix issue with component vertical alignment

Fixes #1202

Breaking API changes:

  • className props now applies to input instead of component field base wrapper.
  • FlowbiteRangeSliderTheme now accepts base and sizes props only.

Copy link

vercel bot commented Jan 9, 2024

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

Name Status Preview Comments Updated (UTC)
flowbite-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2024 0:26am

Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7461173) 99.54% compared to head (08f79f7) 97.35%.
Report is 195 commits behind head on main.

❗ Current head 08f79f7 differs from pull request most recent head a897072. Consider uploading reports for the commit a897072 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1222      +/-   ##
==========================================
- Coverage   99.54%   97.35%   -2.19%     
==========================================
  Files         163      214      +51     
  Lines        6621     9043    +2422     
  Branches      401      530     +129     
==========================================
+ Hits         6591     8804    +2213     
- Misses         30      239     +209     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@tulup-conner tulup-conner left a comment

Choose a reason for hiding this comment

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

Thank you!

<input
ref={ref}
type="range"
className={twMerge(theme.field.input.base, theme.field.input.sizes[sizing], className)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you're doing this, it would be helpful to consolidate the theme API here since we're making the component much simpler, as it should be. It seems like you could change the theme to literally just base and sizes keys.

Remember to consult the Flowbite vanilla docs on RangeSlider for the classes in the theme. I think we have a mismatch already, before your PR.

Copy link
Author

Choose a reason for hiding this comment

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

@tulup-conner Good point, thanks!

remove base wrappers according to vanilla implementation

BREAKING CHANGE: className prop applies directly to input
remove tests for field base and add test for className prop
remove unused field theme props

BREAKING CHANGE: RangeSlider theme API changed
@@ -34,16 +22,7 @@ export const RangeSlider = forwardRef<HTMLInputElement, RangeSliderProps>(

return (
<>
Copy link
Collaborator

Choose a reason for hiding this comment

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

in this case, do we still need the fragment (<>)?

@@ -5,7 +5,7 @@ import { describe, expect, it, vi } from 'vitest';
import { Flowbite, type CustomFlowbiteTheme } from '../Flowbite';
import { RangeSlider } from './RangeSlider';

describe('Components / Button', () => {
describe('Components / RangeSlider', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

good catch & cleanup

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.

Range slider is not vertically centerable
3 participants