import { generateColors } from '@mantine/colors-generator'; import clsx from 'clsx'; import { useEffect, useState } from 'react'; import styles from './library-background-overlay.module.css'; import { useAppThemeColors } from '/@/renderer/themes/use-app-theme'; interface LibraryBackgroundOverlayProps { backgroundColor?: string; headerRef: React.RefObject; opacity?: number; } export const LibraryBackgroundOverlay = ({ backgroundColor, headerRef, opacity = 0.7, }: LibraryBackgroundOverlayProps) => { const height = useHeaderHeight(headerRef); return (
); }; interface BackgroundOverlayProps { backgroundColor?: string; direction?: string; height?: number | string; opacity?: number; } export const BackgroundOverlay = ({ backgroundColor, direction = 'to bottom', height = '100%', opacity, }: BackgroundOverlayProps) => { const theme = useAppThemeColors(); const colors = generateColors(backgroundColor || theme.color['--theme-colors-background']); return (
); }; interface LibraryBackgroundProps { blur?: number; headerRef: React.RefObject; imageUrl: null | string; } export const LibraryBackgroundImage = ({ blur, headerRef, imageUrl }: LibraryBackgroundProps) => { const url = imageUrl ? `url(${imageUrl})` : undefined; const height = useHeaderHeight(headerRef); return ( <>
); }; const useHeaderHeight = (headerRef: React.RefObject) => { const [headerHeight, setHeaderHeight] = useState(0); useEffect(() => { if (!headerRef?.current) return; const updateHeight = () => { if (headerRef?.current) { setHeaderHeight(headerRef.current.offsetHeight); } }; updateHeight(); const resizeObserver = new ResizeObserver(updateHeight); resizeObserver.observe(headerRef.current); return () => { resizeObserver.disconnect(); }; }, [headerRef]); return headerHeight; };