11"use client"
22
33import type React from "react"
4+ import { useState } from "react"
45
56import { motion } from "motion/react"
67import { Badge } from "@/components/ui/badge"
78import { Button } from "@/components/ui/button"
89import { useLocalStorage } from "@/hooks/use-local-storage"
910import { FaChevronDown , FaChevronUp } from "react-icons/fa"
11+ import { EllipsisVertical } from "lucide-react"
12+ import {
13+ DropdownMenu ,
14+ DropdownMenuContent ,
15+ DropdownMenuItem ,
16+ DropdownMenuTrigger ,
17+ } from "@/components/ui/dropdown-menu"
1018
1119interface HeroSectionProps {
1220 title : string
@@ -20,6 +28,10 @@ interface HeroSectionProps {
2028 label : string
2129 onClick : ( ) => void
2230 }
31+ tertiaryAction ?: {
32+ label : string
33+ onClick : ( ) => void
34+ }
2335 gradient : string
2436 children ?: React . ReactNode
2537 className ?: string
@@ -31,6 +43,7 @@ export function DashboardHero({
3143 badge,
3244 primaryAction,
3345 secondaryAction,
46+ tertiaryAction,
3447 gradient,
3548 children,
3649 className,
@@ -39,6 +52,7 @@ export function DashboardHero({
3952 `hero-section-minimized-${ title . replace ( / \s + / g, "-" ) . toLowerCase ( ) } ` ,
4053 ! secondaryAction && ! description ? true : false
4154 )
55+ const [ actionsMenuOpen , setActionsMenuOpen ] = useState ( false )
4256
4357 // Always minimize if there's no content to expand to
4458 const shouldBeMinimized = ( ! secondaryAction && ! description ) || minimized
@@ -65,6 +79,33 @@ export function DashboardHero({
6579 </ Button >
6680 ) }
6781
82+ { shouldBeMinimized && ( secondaryAction || tertiaryAction ) && (
83+ < DropdownMenu open = { actionsMenuOpen } onOpenChange = { setActionsMenuOpen } >
84+ < DropdownMenuTrigger asChild >
85+ < Button
86+ variant = "ghost"
87+ size = "sm"
88+ className = "rounded-2xl bg-white/20 text-white hover:bg-white/30 p-2"
89+ aria-label = "More actions"
90+ >
91+ < EllipsisVertical size = { 20 } />
92+ </ Button >
93+ </ DropdownMenuTrigger >
94+ < DropdownMenuContent align = "end" className = "w-48" >
95+ { secondaryAction && (
96+ < DropdownMenuItem onClick = { secondaryAction . onClick } >
97+ { secondaryAction . label }
98+ </ DropdownMenuItem >
99+ ) }
100+ { tertiaryAction && (
101+ < DropdownMenuItem onClick = { tertiaryAction . onClick } >
102+ { tertiaryAction . label }
103+ </ DropdownMenuItem >
104+ ) }
105+ </ DropdownMenuContent >
106+ </ DropdownMenu >
107+ ) }
108+
68109 { ( secondaryAction || description ) && (
69110 < button
70111 aria-label = { minimized ? "Expand hero section" : "Minimize hero section" }
@@ -100,6 +141,15 @@ export function DashboardHero({
100141 { secondaryAction . label }
101142 </ Button >
102143 ) }
144+ { tertiaryAction && (
145+ < Button
146+ variant = "outline"
147+ className = "rounded-2xl bg-transparent border-white text-white hover:bg-white/10"
148+ onClick = { tertiaryAction . onClick }
149+ >
150+ { tertiaryAction . label }
151+ </ Button >
152+ ) }
103153 </ div >
104154 </ div >
105155 { children && < div className = "hidden lg:block" > { children } </ div > }
0 commit comments