'use client' import type { FC } from 'react' import React from 'react' import cn from 'classnames' import { useTranslation } from 'react-i18next' import { TrashIcon } from '@heroicons/react/24/outline' import s from './style.module.css' import Popover from '@/app/components/base/popover' const PinIcon = ( ) export type IItemOperationProps = { className?: string isPinned: boolean isShowDelete: boolean togglePin: () => void onDelete: () => void } const ItemOperation: FC = ({ className, isPinned, isShowDelete, togglePin, onDelete, }) => { const { t } = useTranslation() return ( { e.stopPropagation() }}>
{PinIcon} {isPinned ? t('explore.sidebar.action.unpin') : t('explore.sidebar.action.pin')}
{isShowDelete && (
{t('explore.sidebar.action.delete')}
)} } trigger='click' position='br' btnElement={
} btnClassName={open => cn(className, s.btn, 'h-6 w-6 rounded-md border-none p-1', open && '!bg-gray-100 !shadow-none')} className={'!w-[120px] h-fit !z-20'} /> ) } export default React.memo(ItemOperation)