mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-17 21:43:06 +00:00
* refactor: Use Spinner Tones, Label Variants and Shared Button Props in Remaining Components Replaces text colour, round shape and size overrides with the primitives' own tone, variant, shape and size props where the merged classes are identical, drops redundant field overrides, and removes the prose and arbitrary transition classes that generated no CSS or have a token form. * test: Cover the Quiet Ink of the Marketplace Search Clear Button * test: Assert the Clear Button Hover Ink Only Where Hover Exists
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { useState } from 'react';
|
|
import { TooltipAnchor, OGDialogTrigger, EditIcon, Button } from '@librechat/client';
|
|
import type { TConversationTag } from 'librechat-data-provider';
|
|
import type { FC } from 'react';
|
|
import BookmarkEditDialog from './BookmarkEditDialog';
|
|
import { useLocalize } from '~/hooks';
|
|
|
|
const EditBookmarkButton: FC<{
|
|
bookmark: TConversationTag;
|
|
tabIndex?: number;
|
|
onFocus?: () => void;
|
|
onBlur?: () => void;
|
|
}> = ({ bookmark, tabIndex = 0, onFocus, onBlur }) => {
|
|
const localize = useLocalize();
|
|
const [open, setOpen] = useState(false);
|
|
|
|
return (
|
|
<BookmarkEditDialog
|
|
context="EditBookmarkButton"
|
|
bookmark={bookmark}
|
|
open={open}
|
|
setOpen={setOpen}
|
|
>
|
|
<OGDialogTrigger asChild>
|
|
<TooltipAnchor
|
|
description={localize('com_ui_edit')}
|
|
render={
|
|
<Button
|
|
variant="ghost"
|
|
aria-label={localize('com_ui_bookmarks_edit')}
|
|
tabIndex={tabIndex}
|
|
onFocus={onFocus}
|
|
onBlur={onBlur}
|
|
onClick={() => setOpen(!open)}
|
|
size="icon-sm"
|
|
>
|
|
<EditIcon />
|
|
</Button>
|
|
}
|
|
/>
|
|
</OGDialogTrigger>
|
|
</BookmarkEditDialog>
|
|
);
|
|
};
|
|
|
|
export default EditBookmarkButton;
|