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

AB-1 fix: Change the light icon button color back to tertiary #8504

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { useState } from 'react';
import {
IconBookmark,
IconBookmarkPlus,
IconDotsVertical,
IconPencil,
IconTrash,
LightButtonProps,
MenuItem,
} from 'twenty-ui';

Expand All @@ -19,6 +21,7 @@ type MultiItemFieldMenuItemProps<T> = {
onDelete?: () => void;
DisplayComponent: React.ComponentType<{ value: T }>;
hasPrimaryButton?: boolean;
rightIconConfig?: Omit<LightButtonProps, 'Icon'>;
};

export const MultiItemFieldMenuItem = <T,>({
Expand All @@ -30,6 +33,7 @@ export const MultiItemFieldMenuItem = <T,>({
onDelete,
DisplayComponent,
hasPrimaryButton = true,
rightIconConfig,
}: MultiItemFieldMenuItemProps<T>) => {
const [isHovered, setIsHovered] = useState(false);
const { isDropdownOpen, closeDropdown } = useDropdown(dropdownId);
Expand Down Expand Up @@ -64,7 +68,10 @@ export const MultiItemFieldMenuItem = <T,>({
onMouseLeave={handleMouseLeave}
text={<DisplayComponent value={value} />}
isIconDisplayedOnHoverOnly={!isPrimary && !isDropdownOpen}
RightIcon={!isHovered && isPrimary ? IconBookmark : null}
rightIconConfig={{
Icon: !isHovered && isPrimary ? IconBookmark : IconDotsVertical,
...rightIconConfig,
}}
dropdownId={dropdownId}
dropdownContent={
<DropdownMenuItemsContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const PhonesFieldMenuItem = ({
onSetAsPrimary={onSetAsPrimary}
onDelete={onDelete}
DisplayComponent={PhoneDisplay}
rightIconConfig={{ accent: 'tertiary' }}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { FunctionComponent, MouseEvent, ReactElement, ReactNode } from 'react';
import {
IconChevronRight,
IconComponent,
IconDotsVertical,
LightIconButton,
LightIconButtonProps,
MenuItemAccent,
Expand All @@ -29,7 +28,7 @@ export type MenuItemWithOptionDropdownProps = {
isIconDisplayedOnHoverOnly?: boolean;
isTooltipOpen?: boolean;
LeftIcon?: IconComponent | null;
RightIcon?: IconComponent | null;
rightIconConfig?: LightIconButtonProps;
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
onMouseLeave?: (event: MouseEvent<HTMLDivElement>) => void;
Expand All @@ -46,7 +45,7 @@ export const MenuItemWithOptionDropdown = ({
dropdownContent,
dropdownId,
LeftIcon,
RightIcon,
rightIconConfig,
onClick,
onMouseEnter,
onMouseLeave,
Expand Down Expand Up @@ -79,12 +78,7 @@ export const MenuItemWithOptionDropdown = ({
</StyledMenuItemLeftContent>
<div className="hoverable-buttons">
<Dropdown
clickableComponent={
<LightIconButton
Icon={RightIcon ?? IconDotsVertical}
size="small"
/>
}
clickableComponent={<LightIconButton {...rightIconConfig} />}
dropdownComponents={dropdownContent}
dropdownId={dropdownId}
dropdownHotkeyScope={{ scope: SelectHotkeyScope.Select }}
Expand Down
Loading