Skip to content

Commit 79fc0c8

Browse files
fix: toolbar dropdown toggle (calcom#28097)
1 parent a2b25fa commit 79fc0c8

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

packages/ui/components/editor/plugins/ToolbarPlugin.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { createPortal } from "react-dom";
2929

3030
import { Button } from "../../button";
3131
import { Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../../dropdown";
32-
import { ChevronDownIcon } from "@coss/ui/icons";
32+
import { ChevronDownIcon, ChevronUpIcon } from "@coss/ui/icons";
3333
import type { TextEditorProps } from "../types";
3434
import { AddVariablesDropdown } from "./AddVariablesDropdown";
3535

@@ -247,7 +247,7 @@ export default function ToolbarPlugin(props: TextEditorProps) {
247247
const [isLink, setIsLink] = useState(false);
248248
const [isBold, setIsBold] = useState(false);
249249
const [isItalic, setIsItalic] = useState(false);
250-
250+
const [isOpen, setIsOpen] = useState(false);
251251
const formatParagraph = () => {
252252
if (blockType !== "paragraph") {
253253
editor.update(() => {
@@ -459,14 +459,16 @@ export default function ToolbarPlugin(props: TextEditorProps) {
459459
<>
460460
{!props.excludedToolbarItems?.includes("blockType") && (
461461
<>
462-
<Dropdown>
462+
<Dropdown onOpenChange={setIsOpen} open={isOpen}>
463463
<DropdownMenuTrigger className="text-subtle">
464464
<>
465465
<span className={`icon${blockType}`} />
466466
<span className="text text-default hidden sm:flex">
467467
{blockTypeToBlockName[blockType as keyof BlockType]}
468468
</span>
469-
<ChevronDownIcon className="text-default ml-2 h-4 w-4" />
469+
{
470+
isOpen ? (<ChevronUpIcon className="text-default ml-2 h-4 w-4" />) : (<ChevronDownIcon className="text-default ml-2 h-4 w-4" />)
471+
}
470472
</>
471473
</DropdownMenuTrigger>
472474
<DropdownMenuContent align="start" className="flex flex-col gap-1">

0 commit comments

Comments
 (0)