我正在使用适用于 Windows 的 GlazeWM,GlazeWM 可以与 Zebar 配合使用。我使用 React 创建自己的小部件栏,现在我想在单击日期小部件时添加日历之类的内容。但该日历无法显示在 Zebar 之外。如何做到这一点?
下面是我调用日历的代码。
import { useState, useEffect } from "react"
import { createProviderGroup } from "zebar"
import { CalendarIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { Calendar } from "@/components/ui/calendar"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
const providers = createProviderGroup({
date: { type: "date", formatting: "EEE d MMM t" },
})
const Center = () => {
const [output, setOutput] = useState(providers.outputMap)
useEffect(() => {
providers.onOutput(() => setOutput(providers.outputMap));
}, [])
return (
<div className="center">
<Popover>
<PopoverTrigger asChild>
<Button
variant={"outline"}
className={cn(
"w-[240px] justify-start text-left font-normal",
"text-muted-foreground"
)}
>
<CalendarIcon />
{output.date?.formatted}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0 pt-1" align="start">
<Calendar
mode="single"
initialFocus
/>
</PopoverContent>
</Popover>
</div>
)
}
export default Center