♻️ refactor: change project bar item component to button

This commit is contained in:
Wahyu Kurniawan 2024-03-06 15:14:09 +07:00
parent 7aac8cdcef
commit 8d3ef369bb
No known key found for this signature in database
GPG Key ID: 040A1549143A8E33

View File

@ -11,7 +11,7 @@ import { getInitials } from 'utils/geInitials';
* @type {MergedComponentPropsWithoutRef} * @type {MergedComponentPropsWithoutRef}
*/ */
type MergedComponentPropsWithoutRef = OmitCommon< type MergedComponentPropsWithoutRef = OmitCommon<
ComponentPropsWithoutRef<'div'>, ComponentPropsWithoutRef<'button'>,
Omit< Omit<
Overwrite<UseComboboxGetItemPropsReturnValue, Project[]>, Overwrite<UseComboboxGetItemPropsReturnValue, Project[]>,
'index' | 'item' 'index' | 'item'
@ -24,16 +24,16 @@ interface ProjectSearchBarItemProps extends MergedComponentPropsWithoutRef {
} }
const ProjectSearchBarItem = forwardRef< const ProjectSearchBarItem = forwardRef<
HTMLDivElement, HTMLButtonElement,
ProjectSearchBarItemProps ProjectSearchBarItemProps
>(({ item, active, ...props }, ref) => { >(({ item, active, ...props }, ref) => {
return ( return (
<div <button
{...props} {...props}
ref={ref} ref={ref}
key={item.id} key={item.id}
className={cn( className={cn(
'px-2 py-2 flex items-center gap-3 rounded-lg hover:bg-base-bg-emphasized', 'px-2 py-2 flex items-center gap-3 rounded-lg text-left hover:bg-base-bg-emphasized',
{ {
'bg-base-bg-emphasized': active, 'bg-base-bg-emphasized': active,
}, },
@ -50,7 +50,7 @@ const ProjectSearchBarItem = forwardRef<
</p> </p>
<p className="text-xs text-elements-low-em">{item.organization.name}</p> <p className="text-xs text-elements-low-em">{item.organization.name}</p>
</div> </div>
</div> </button>
); );
}); });