fix: TimeZone dropdown clips through screen in Mobile viewport (#7935)
## Description - This PR fixes the issue #7934 --------- Co-authored-by: martmull <martmull@hotmail.fr>
This commit is contained in:
@ -31,6 +31,7 @@ export type SelectProps<Value extends string | number | null> = {
|
|||||||
disableBlur?: boolean;
|
disableBlur?: boolean;
|
||||||
dropdownId: string;
|
dropdownId: string;
|
||||||
dropdownWidth?: `${string}px` | 'auto' | number;
|
dropdownWidth?: `${string}px` | 'auto' | number;
|
||||||
|
dropdownWidthAuto?: boolean;
|
||||||
emptyOption?: SelectOption<Value>;
|
emptyOption?: SelectOption<Value>;
|
||||||
fullWidth?: boolean;
|
fullWidth?: boolean;
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -60,6 +61,7 @@ export const Select = <Value extends string | number | null>({
|
|||||||
disableBlur = false,
|
disableBlur = false,
|
||||||
dropdownId,
|
dropdownId,
|
||||||
dropdownWidth = 176,
|
dropdownWidth = 176,
|
||||||
|
dropdownWidthAuto = false,
|
||||||
emptyOption,
|
emptyOption,
|
||||||
fullWidth,
|
fullWidth,
|
||||||
label,
|
label,
|
||||||
@ -94,6 +96,11 @@ export const Select = <Value extends string | number | null>({
|
|||||||
|
|
||||||
const { closeDropdown } = useDropdown(dropdownId);
|
const { closeDropdown } = useDropdown(dropdownId);
|
||||||
|
|
||||||
|
const dropDownMenuWidth =
|
||||||
|
dropdownWidthAuto && selectContainerRef.current?.clientWidth
|
||||||
|
? selectContainerRef.current?.clientWidth
|
||||||
|
: dropdownWidth;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer
|
<StyledContainer
|
||||||
className={className}
|
className={className}
|
||||||
@ -111,7 +118,7 @@ export const Select = <Value extends string | number | null>({
|
|||||||
) : (
|
) : (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
dropdownId={dropdownId}
|
dropdownId={dropdownId}
|
||||||
dropdownMenuWidth={dropdownWidth}
|
dropdownMenuWidth={dropDownMenuWidth}
|
||||||
dropdownPlacement="bottom-start"
|
dropdownPlacement="bottom-start"
|
||||||
clickableComponent={
|
clickableComponent={
|
||||||
<SelectControl
|
<SelectControl
|
||||||
|
|||||||
@ -28,6 +28,7 @@ export const DateTimeSettingsDateFormatSelect = ({
|
|||||||
dropdownWidth={218}
|
dropdownWidth={218}
|
||||||
label="Date format"
|
label="Date format"
|
||||||
fullWidth
|
fullWidth
|
||||||
|
dropdownWidthAuto
|
||||||
value={value}
|
value={value}
|
||||||
options={[
|
options={[
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,7 @@ export const DateTimeSettingsTimeFormatSelect = ({
|
|||||||
dropdownId="datetime-settings-time-format"
|
dropdownId="datetime-settings-time-format"
|
||||||
dropdownWidth={218}
|
dropdownWidth={218}
|
||||||
label="Time format"
|
label="Time format"
|
||||||
|
dropdownWidthAuto
|
||||||
fullWidth
|
fullWidth
|
||||||
value={value}
|
value={value}
|
||||||
options={[
|
options={[
|
||||||
|
|||||||
@ -19,9 +19,10 @@ export const DateTimeSettingsTimeZoneSelect = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
|
disableBlur
|
||||||
dropdownId="settings-accounts-calendar-time-zone"
|
dropdownId="settings-accounts-calendar-time-zone"
|
||||||
dropdownWidth={416}
|
|
||||||
label="Time zone"
|
label="Time zone"
|
||||||
|
dropdownWidthAuto
|
||||||
fullWidth
|
fullWidth
|
||||||
value={value}
|
value={value}
|
||||||
options={[
|
options={[
|
||||||
|
|||||||
Reference in New Issue
Block a user