Fix dropdown width (#11536)

Fix regressions due to dropdown refactoring
This commit is contained in:
Charles Bochet
2025-04-11 14:59:57 +02:00
committed by GitHub
parent fe98deef4e
commit 9da5cca82a
5 changed files with 7 additions and 13 deletions

View File

@ -1,5 +1,4 @@
import { DROPDOWN_OFFSET_Y } from '@/dropdown/constants/DropdownOffsetY'; import { DROPDOWN_OFFSET_Y } from '@/dropdown/constants/DropdownOffsetY';
import { DROPDOWN_WIDTH } from '@/dropdown/constants/DropdownWidth';
import { useCurrentContentId } from '@/dropdown/hooks/useCurrentContentId'; import { useCurrentContentId } from '@/dropdown/hooks/useCurrentContentId';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { ObjectOptionsDropdownContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownContent'; import { ObjectOptionsDropdownContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownContent';
@ -33,7 +32,6 @@ export const ObjectOptionsDropdown = ({
<Dropdown <Dropdown
dropdownId={OBJECT_OPTIONS_DROPDOWN_ID} dropdownId={OBJECT_OPTIONS_DROPDOWN_ID}
dropdownHotkeyScope={{ scope: TableOptionsHotkeyScope.Dropdown }} dropdownHotkeyScope={{ scope: TableOptionsHotkeyScope.Dropdown }}
dropdownWidth={DROPDOWN_WIDTH}
dropdownOffset={{ y: DROPDOWN_OFFSET_Y }} dropdownOffset={{ y: DROPDOWN_OFFSET_Y }}
clickableComponent={ clickableComponent={
<StyledHeaderDropdownButton isUnfolded={isDropdownOpen}> <StyledHeaderDropdownButton isUnfolded={isDropdownOpen}>

View File

@ -12,13 +12,13 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys'; import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { IconCheck, IconPlus } from 'twenty-ui/display';
import { LightIconButton } from 'twenty-ui/input';
import { MenuItem } from 'twenty-ui/navigation';
import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldMetadataType } from '~/generated-metadata/graphql';
import { moveArrayItem } from '~/utils/array/moveArrayItem'; import { moveArrayItem } from '~/utils/array/moveArrayItem';
import { toSpliced } from '~/utils/array/toSpliced'; import { toSpliced } from '~/utils/array/toSpliced';
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly'; import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
import { IconCheck, IconPlus } from 'twenty-ui/display';
import { LightIconButton } from 'twenty-ui/input';
import { MenuItem } from 'twenty-ui/navigation';
type MultiItemFieldInputProps<T> = { type MultiItemFieldInputProps<T> = {
items: T[]; items: T[];
@ -180,7 +180,7 @@ export const MultiItemFieldInput = <T,>({
}; };
return ( return (
<DropdownMenu ref={containerRef} width={200}> <DropdownMenu ref={containerRef}>
{!!items.length && ( {!!items.length && (
<> <>
<DropdownMenuItemsContainer> <DropdownMenuItemsContainer>

View File

@ -152,10 +152,7 @@ export const Select = <Value extends SelectValue>({
<DropdownMenuSeparator /> <DropdownMenuSeparator />
)} )}
{!!filteredOptions.length && ( {!!filteredOptions.length && (
<DropdownMenuItemsContainer <DropdownMenuItemsContainer hasMaxHeight width={'auto'}>
hasMaxHeight
width={dropDownMenuWidth}
>
{filteredOptions.map((option) => ( {filteredOptions.map((option) => (
<MenuItemSelect <MenuItemSelect
key={`${option.value}-${option.label}`} key={`${option.value}-${option.label}`}

View File

@ -6,7 +6,7 @@ import { isDefined } from 'twenty-shared/utils';
const StyledDropdownMenuItemsExternalContainer = styled.div<{ const StyledDropdownMenuItemsExternalContainer = styled.div<{
hasMaxHeight?: boolean; hasMaxHeight?: boolean;
width: number; width: number | 'auto';
}>` }>`
--padding: ${({ theme }) => theme.spacing(1)}; --padding: ${({ theme }) => theme.spacing(1)};
@ -52,7 +52,7 @@ export const DropdownMenuItemsContainer = ({
hasMaxHeight?: boolean; hasMaxHeight?: boolean;
className?: string; className?: string;
scrollable?: boolean; scrollable?: boolean;
width?: number; width?: number | 'auto';
}) => { }) => {
const id = useId(); const id = useId();

View File

@ -166,7 +166,6 @@ export const WorkflowEditTriggerDatabaseEventForm = ({
<StyledLabel>Record Type</StyledLabel> <StyledLabel>Record Type</StyledLabel>
<Dropdown <Dropdown
dropdownId="workflow-edit-trigger-record-type" dropdownId="workflow-edit-trigger-record-type"
dropdownWidth={300}
dropdownPlacement="bottom-start" dropdownPlacement="bottom-start"
clickableComponent={ clickableComponent={
<SelectControl <SelectControl