Files
twenty/packages/twenty-front/src/pages/settings/profile/appearance/components/DateTimeSettingsTimeZoneSelect.tsx
Harshit Singh cabae4c462 fix: TimeZone dropdown clips through screen in Mobile viewport (#7935)
## Description

- This PR fixes the issue #7934

---------

Co-authored-by: martmull <martmull@hotmail.fr>
2024-10-28 16:11:41 +00:00

42 lines
1.2 KiB
TypeScript

import { detectTimeZone } from '@/localization/utils/detectTimeZone';
import { findAvailableTimeZoneOption } from '@/localization/utils/findAvailableTimeZoneOption';
import { AVAILABLE_TIMEZONE_OPTIONS } from '@/settings/accounts/constants/AvailableTimezoneOptions';
import { Select } from '@/ui/input/components/Select';
import { isDefined } from '~/utils/isDefined';
type DateTimeSettingsTimeZoneSelectProps = {
value?: string;
onChange: (nextValue: string) => void;
};
export const DateTimeSettingsTimeZoneSelect = ({
value = detectTimeZone(),
onChange,
}: DateTimeSettingsTimeZoneSelectProps) => {
const systemTimeZone = detectTimeZone();
const systemTimeZoneOption = findAvailableTimeZoneOption(systemTimeZone);
return (
<Select
disableBlur
dropdownId="settings-accounts-calendar-time-zone"
label="Time zone"
dropdownWidthAuto
fullWidth
value={value}
options={[
{
label: isDefined(systemTimeZoneOption)
? `System settings - ${systemTimeZoneOption.label}`
: 'System settings',
value: 'system',
},
...AVAILABLE_TIMEZONE_OPTIONS,
]}
onChange={onChange}
withSearchInput
/>
);
};