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(DateRangePicker): fix layout misalignment due to missing min-width #3523

Merged
merged 2 commits into from
Dec 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/DateRangePicker/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,12 @@ const DateRangePicker: DateRangePicker = React.forwardRef((props: DateRangePicke
const panelClasses = prefix('daterange-panel', {
'daterange-panel-show-one-calendar': showOneCalendar
});

/**
* Set a min-width (528px) when there are two calendars
* @see https://github.com/rsuite/rsuite/issues/3522
*/
const panelStyles: React.CSSProperties = { minWidth: showOneCalendar ? 'auto' : 528 };
const styles = { ...menuStyle, left, top };

const calendarProps = {
Expand Down Expand Up @@ -846,7 +852,7 @@ const DateRangePicker: DateRangePicker = React.forwardRef((props: DateRangePicke
target={triggerRef}
style={styles}
>
<div className={panelClasses}>
<div className={panelClasses} style={panelStyles}>
<Stack alignItems="flex-start">
{sideRanges.length > 0 && (
<PredefinedRanges
Expand Down
Loading