main
tsx 38 lines 1.09 KB
Raw
1 import { ArrowLeft } from "lucide-react";
2 import { useNavigate } from "react-router-dom";
3 import { Button } from "@/components/ui/button";
4
5 interface ToolbarProps {
6 title: string;
7 showBack?: boolean;
8 rightAction?: React.ReactNode;
9 }
10
11 const Toolbar = ({ title, showBack = false, rightAction }: ToolbarProps) => {
12 const navigate = useNavigate();
13
14 return (
15 <header className="sticky top-0 z-50 bg-toolbar-bg border-b border-toolbar-border">
16 <div className="flex items-center justify-between h-14 px-4">
17 <div className="flex items-center gap-2 flex-1">
18 {showBack && (
19 <Button
20 variant="ghost"
21 size="icon"
22 onClick={() => navigate(-1)}
23 className="h-9 w-9"
24 >
25 <ArrowLeft className="h-5 w-5" />
26 </Button>
27 )}
28 <h1 className="text-lg font-semibold text-foreground truncate">
29 {title}
30 </h1>
31 </div>
32 {rightAction && <div className="flex-shrink-0">{rightAction}</div>}
33 </div>
34 </header>
35 );
36 };
37
38 export default Toolbar;