Skip to content

Commit 984e6a9

Browse files
authored
Refactor SupportedBySection layout in Hero3D component (#30)
* Refactor SupportedBySection layout in Hero3D component - Streamlined the structure of the SupportedBySection by removing unnecessary fragments and improving the layout for better readability. - Adjusted mobile carousel styling for enhanced responsiveness and visual consistency. - Maintained existing functionality while improving code clarity and maintainability. * Refactor mobile carousel in SupportedBySection of Hero3D component - Simplified the mobile carousel layout by removing unnecessary elements and adjusting styling for better responsiveness. - Enhanced the structure for improved readability while maintaining existing functionality. - Updated animation properties for a smoother user experience on mobile devices. * Refactor SupportedBySection layout in Hero3D component - Updated the logo display to use a grid layout for both desktop and mobile views, enhancing visual consistency and responsiveness. - Changed the section title from "SUPPORTED BY" to "BACKED BY" for improved clarity. - Removed the duplicated logos logic for a more streamlined implementation, simplifying the rendering process. * Add ArrowUpRight icon to logo display in Hero3D component - Introduced the ArrowUpRight icon to enhance visual feedback on logo hover states. - Updated logo container to improve layout and responsiveness, ensuring a smoother user experience. - Adjusted styling for the icon to maintain consistency with existing design elements.
1 parent 48ec1c8 commit 984e6a9

1 file changed

Lines changed: 45 additions & 40 deletions

File tree

apps/app/src/components/custom-ui/hero-3d.tsx

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Button } from "@/components/ui/button"
77
import { cn } from "@/lib/utils"
88
import HighlighterText from "./highlighter-text"
99
import Logo3D from "./logo-3d"
10+
import { ArrowUpRight } from "lucide-react"
1011
import {
1112
motion,
1213
useReducedMotion,
@@ -83,22 +84,32 @@ const renderLogo = (logo: typeof SUPPORTED_BY_LOGOS[number], index?: number) =>
8384
>
8485
<div
8586
className={cn(
86-
"h-8 px-4 flex items-center justify-center rounded-[2px] transition-all duration-300 min-w-[140px]",
87+
"h-10 px-4 flex items-center justify-center rounded-[2px] transition-all duration-300 min-w-[140px] w-full relative overflow-hidden",
8788
logo.name === "colosseum"
8889
? "bg-[#1C2123] dark:bg-[#D8DDDF] group-hover:opacity-90"
8990
: "bg-muted/50 group-hover:bg-muted"
9091
)}
9192
>
92-
<div
93-
className={cn(
94-
"transition-all duration-300",
95-
logoSize.className,
96-
logo.name === "colosseum"
97-
? "[background-color:var(--background)] dark:[background-color:var(--background)]"
98-
: "opacity-70 group-hover:opacity-100 [background-color:var(--foreground)]"
99-
)}
100-
style={getMaskStyle(logo.src)}
101-
/>
93+
<span className="relative inline-flex items-center transition-transform duration-300 ease-out group-hover:-translate-x-1">
94+
<div
95+
className={cn(
96+
"transition-all duration-300",
97+
logoSize.className,
98+
logo.name === "colosseum"
99+
? "[background-color:var(--background)] dark:[background-color:var(--background)]"
100+
: "opacity-70 group-hover:opacity-100 [background-color:var(--foreground)]"
101+
)}
102+
style={getMaskStyle(logo.src)}
103+
/>
104+
<ArrowUpRight
105+
className={cn(
106+
"absolute left-full ml-2 h-3.5 w-3.5 shrink-0 opacity-0 -translate-x-2 transition-all duration-300 ease-out group-hover:opacity-100 group-hover:translate-x-0",
107+
logo.name === "colosseum"
108+
? "[color:var(--background)] dark:[color:var(--background)]"
109+
: "text-foreground"
110+
)}
111+
/>
112+
</span>
102113
<Image
103114
src={logo.src}
104115
alt={`${logo.name} logo`}
@@ -131,40 +142,34 @@ export function SupportedBySection() {
131142
[prefersReduced]
132143
)
133144

134-
// Duplicate logos for seamless infinite scroll (exactly 2 copies for -50% animation)
135-
const duplicatedLogos = [...SUPPORTED_BY_LOGOS, ...SUPPORTED_BY_LOGOS]
136-
137145
return (
138-
<>
139-
<motion.section
140-
className="mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8 py-8 sm:py-16"
141-
initial="hidden"
142-
animate={isMounted ? "visible" : "hidden"}
143-
variants={fadeUp}
144-
>
145-
<div className="flex flex-col items-start space-y-4">
146-
<HighlighterText>SUPPORTED BY</HighlighterText>
147-
148-
{/* Desktop: flex-wrap layout */}
149-
<div className="hidden md:flex flex-wrap gap-3">
150-
{SUPPORTED_BY_LOGOS.map((logo) => renderLogo(logo))}
151-
</div>
146+
<motion.section
147+
className="mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8 py-8 sm:py-16"
148+
initial="hidden"
149+
animate={isMounted ? "visible" : "hidden"}
150+
variants={fadeUp}
151+
>
152+
<div className="flex flex-col items-start space-y-4">
153+
<HighlighterText>BACKED BY</HighlighterText>
154+
155+
{/* Desktop: grid layout - equal width logos */}
156+
<div className="hidden md:grid md:grid-cols-5 gap-3 w-full">
157+
{SUPPORTED_BY_LOGOS.map((logo) => renderLogo(logo))}
152158
</div>
153-
</motion.section>
154159

155-
{/* Mobile: auto-scrolling carousel - full width to edge */}
156-
<div className="md:hidden -mt-4 overflow-hidden" style={{ width: '100vw', marginLeft: 'calc(-50vw + 50%)', marginRight: 'calc(-50vw + 50%)' }}>
157-
<div
158-
className="flex gap-3"
159-
style={{
160-
width: 'max-content',
161-
animation: prefersReduced ? 'none' : 'scroll-carousel 25s linear infinite',
162-
}}
163-
>
164-
{duplicatedLogos.map((logo, index) => renderLogo(logo, index))}
160+
{/* Mobile: grid layout - 2 columns, Colosseum spans full width */}
161+
<div className="md:hidden grid grid-cols-2 gap-3 w-full mt-4">
162+
{SUPPORTED_BY_LOGOS.map((logo, index) => (
163+
<div
164+
key={logo.name}
165+
className={logo.name === "colosseum" ? "col-span-2" : ""}
166+
>
167+
{renderLogo(logo)}
168+
</div>
169+
))}
165170
</div>
166171
</div>
167-
</>
172+
</motion.section>
168173
)
169174
}
170175

0 commit comments

Comments
 (0)