|
| 1 | +import { useTheme } from '@/context' |
1 | 2 | import { cn } from '@utils/cn' |
2 | 3 |
|
3 | 4 | type HighlightTheme = 'blue' | 'green' | 'error' |
@@ -66,43 +67,49 @@ const highlightThemes = { |
66 | 67 |
|
67 | 68 | interface HighlightedFloatingLayoutProps extends Floating1ColumnLayoutProps { |
68 | 69 | theme: HighlightTheme |
| 70 | + hasGradients?: boolean |
69 | 71 | } |
70 | 72 |
|
71 | 73 | const HighlightedFloatingLayout = ({ children, className, theme = 'blue' }: HighlightedFloatingLayoutProps) => { |
| 74 | + const { isLightTheme } = useTheme() |
| 75 | + |
| 76 | + const hasGradients = !isLightTheme |
72 | 77 | const { topAdditionalGradient, topGradient, bottomGradient } = highlightThemes[theme] |
73 | 78 | const isError = theme === 'error' |
74 | 79 |
|
75 | 80 | return ( |
76 | 81 | <Floating1ColumnLayout className={cn(className, 'relative max-w-full overflow-hidden')}> |
77 | | - <div className="pointer-events-none absolute inset-0 z-0" aria-hidden> |
78 | | - <span |
79 | | - className={cn( |
80 | | - 'absolute blur-[30px] top-0 left-1/2 -translate-y-1/2 w-[528px] h-[178px] rounded-[100%] opacity-10 mix-blend-plus-lighter', |
81 | | - '[mask-image:radial-gradient(50%_50%_at_50%_50%,#000_30%,transparent_100%)]', |
82 | | - 'transition-[transform,background-color] ease-in-out duration-700', |
83 | | - isError ? '-translate-x-[28%]' : ' -translate-x-[65%]', |
84 | | - topAdditionalGradient |
85 | | - )} |
86 | | - /> |
87 | | - <span |
88 | | - className={cn( |
89 | | - 'absolute blur-[30px] top-3.5 -translate-y-1/2 left-1/2 w-[895px] h-[377px] rounded-[100%] opacity-[0.14]', |
90 | | - '[mask-image:radial-gradient(50%_50%_at_50%_50%,#000_0%,transparent_100%)]', |
91 | | - 'transition-[transform,background-color] ease-in-out duration-700', |
92 | | - isError ? '-translate-x-[11%]' : ' -translate-x-[84.5%]', |
93 | | - topGradient |
94 | | - )} |
95 | | - /> |
96 | | - <span |
97 | | - className={cn( |
98 | | - 'absolute blur-[30px] bottom-0 translate-y-1/2 left-1/2 w-[895px] h-[261px] rounded-[100%] opacity-[0.08]', |
99 | | - '[mask-image:radial-gradient(50%_50%_at_50%_50%,#000_0%,transparent_100%)]', |
100 | | - 'transition-[transform,background-color] ease-in-out duration-700', |
101 | | - isError ? '-translate-x-[88.5%]' : ' -translate-x-[104px]', |
102 | | - bottomGradient |
103 | | - )} |
104 | | - /> |
105 | | - </div> |
| 82 | + {hasGradients && ( |
| 83 | + <div className="pointer-events-none absolute inset-0 z-0" aria-hidden> |
| 84 | + <span |
| 85 | + className={cn( |
| 86 | + 'absolute blur-[30px] top-0 left-1/2 -translate-y-1/2 w-[528px] h-[178px] rounded-[100%] opacity-10 mix-blend-plus-lighter', |
| 87 | + '[mask-image:radial-gradient(50%_50%_at_50%_50%,#000_30%,transparent_100%)]', |
| 88 | + 'transition-[transform,background-color] ease-in-out duration-700', |
| 89 | + isError ? '-translate-x-[28%]' : ' -translate-x-[65%]', |
| 90 | + topAdditionalGradient |
| 91 | + )} |
| 92 | + /> |
| 93 | + <span |
| 94 | + className={cn( |
| 95 | + 'absolute blur-[30px] top-3.5 -translate-y-1/2 left-1/2 w-[895px] h-[377px] rounded-[100%] opacity-[0.14]', |
| 96 | + '[mask-image:radial-gradient(50%_50%_at_50%_50%,#000_0%,transparent_100%)]', |
| 97 | + 'transition-[transform,background-color] ease-in-out duration-700', |
| 98 | + isError ? '-translate-x-[11%]' : ' -translate-x-[84.5%]', |
| 99 | + topGradient |
| 100 | + )} |
| 101 | + /> |
| 102 | + <span |
| 103 | + className={cn( |
| 104 | + 'absolute blur-[30px] bottom-0 translate-y-1/2 left-1/2 w-[895px] h-[261px] rounded-[100%] opacity-[0.08]', |
| 105 | + '[mask-image:radial-gradient(50%_50%_at_50%_50%,#000_0%,transparent_100%)]', |
| 106 | + 'transition-[transform,background-color] ease-in-out duration-700', |
| 107 | + isError ? '-translate-x-[88.5%]' : ' -translate-x-[104px]', |
| 108 | + bottomGradient |
| 109 | + )} |
| 110 | + /> |
| 111 | + </div> |
| 112 | + )} |
106 | 113 |
|
107 | 114 | {children} |
108 | 115 | </Floating1ColumnLayout> |
|
0 commit comments