Files
supabase/apps/studio/components/ui/BannerStack/BannerCard.tsx
T
kemal.earth ce48c64f68 feat(studio): generic observability banner (#40957)
* feat: more generic observability banner on db report

* feat: try popup in corner

* feat: tidy up and fix up event as well

* feat: add event for dismiss as well

* feat: add supplementary link at bottom of reports

* fix: sizing of fonts

* feat: banner stack approach

* fix: isIndexAdvisorAvailable dep

* chore: remove unused import for old banner

* feat: remove unused isDismissed

* chore: remove unused cn

* chore: change prio on query perf page

* chore: remove unused sendEvent

* chore: better useEffect cleanup

* chore: remove unused index advisor notice

* fix: priority of banner stack

* fix: first time loader flickering

* chore: lowercase the word Free

* feat: add IS_PLATFORM to make sure metrics api banner is scoped to platform

* chore: another copy update for observability link

* fix: telemetry keys to match styleguide

* fix: use the correct way to apply events

* feat: add events for index advisor banner too

* chore: delete unused old banner

* fix: dismiss buttons not working

* feat: add extra event to enable index advisor
2025-12-04 11:42:31 +00:00

50 lines
1.6 KiB
TypeScript

import { X } from 'lucide-react'
import { Button, Card, CardContent, cn } from 'ui'
import { BASE_PATH } from 'lib/constants'
interface BannerCardProps {
onDismiss?: () => void
children: React.ReactNode
className?: string
}
export const BannerCard = ({ onDismiss, children, className }: BannerCardProps) => {
return (
<Card className={cn('relative overflow-hidden shadow-lg rounded-2xl', className)}>
<div className="absolute -inset-16 z-0 opacity-100 pointer-events-none">
<img
src={`${BASE_PATH}/img/reports/bg-grafana-dark.svg`}
alt="Background pattern"
className="w-full h-full object-cover object-right hidden dark:block"
/>
<img
src={`${BASE_PATH}/img/reports/bg-grafana-light.svg`}
alt="Background pattern"
className="w-full h-full object-cover object-right dark:hidden"
/>
<div className="absolute inset-0 bg-gradient-to-r from-background-alternative to-transparent" />
</div>
<CardContent className="relative z-10 p-6">
{onDismiss && (
<div className="absolute top-4 right-4 z-20">
<Button
type="text"
size="tiny"
htmlType="button"
icon={<X size={16} strokeWidth={1.5} />}
onClick={(e) => {
e.preventDefault()
onDismiss()
}}
className="opacity-75 hover:opacity-100 px-1"
aria-label="Close banner"
/>
</div>
)}
{children}
</CardContent>
</Card>
)
}