-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/organizer carousel #535
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d136735
add placeholder organizer section
pandyrew b5f1697
change links
pandyrew 02b34ff
sanity retreival
pandyrew 28fc629
build issues
pandyrew a0293cf
Fix issues with loading
pandyrew 798d203
commit before merge
pandyrew 798d39e
Merge remote-tracking branch 'origin/main' into feat/organizer-carousel
pandyrew ccceba5
Utilize correct Image and img for images in organizer carosel
pandyrew a14d9bc
fix sanity cors
waalbert 1bcf063
remove unused imports/props
waalbert 83b9b9e
Merge branch 'main' into feat/organizer-carousel
waalbert 9ca8b30
disable eslint
waalbert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { defineType, defineField, defineArrayMember } from "sanity"; | ||
import { Users } from "lucide-react"; | ||
|
||
export default defineType({ | ||
name: "organizers", | ||
title: "Organizers", | ||
icon: Users, | ||
type: "document", | ||
fields: [ | ||
defineField({ | ||
name: "organizers", | ||
title: "Organizers", | ||
type: "array", | ||
of: [ | ||
defineArrayMember({ | ||
type: "object", | ||
name: "organizer", | ||
fields: [ | ||
defineField({ | ||
name: "name", | ||
title: "Name", | ||
type: "string", | ||
validation: (Rule) => Rule.required(), | ||
}), | ||
defineField({ | ||
name: "department", | ||
title: "Department", | ||
type: "string", | ||
validation: (Rule) => Rule.required(), | ||
options: { | ||
list: [ | ||
{ title: "Tech", value: "Tech" }, | ||
{ title: "Marketing", value: "Marketing" }, | ||
{ title: "Logistics", value: "Logistics" }, | ||
{ title: "Corporate", value: "Corporate" }, | ||
{ title: "Graphics", value: "Graphics" }, | ||
], | ||
}, | ||
}), | ||
defineField({ | ||
name: "role", | ||
title: "Role", | ||
type: "string", | ||
validation: (Rule) => Rule.required(), | ||
options: { | ||
list: [ | ||
{ title: "Director", value: "Director" }, | ||
{ title: "Organizer", value: "Organizer" }, | ||
{ title: "Intern", value: "Intern" }, | ||
{ title: "Advisor", value: "Advisor" }, | ||
], | ||
}, | ||
}), | ||
defineField({ | ||
name: "image", | ||
title: "Profile Image", | ||
type: "image", | ||
options: { | ||
hotspot: true, | ||
}, | ||
}), | ||
defineField({ | ||
name: "link", | ||
title: "Social Link", | ||
type: "url", | ||
description: "LinkedIn or other social media profile link", | ||
}), | ||
], | ||
}), | ||
], | ||
}), | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
apps/site/src/app/(main)/(home)/sections/InfiniteMovingCards.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
"use client"; | ||
|
||
import React, { useEffect, useState } from "react"; | ||
|
||
export const InfiniteMovingCards = ({ | ||
items, | ||
}: { | ||
items: { | ||
quote: string; | ||
name: string; | ||
title: string; | ||
image: string; | ||
link: string; | ||
}[]; | ||
direction?: "left" | "right"; | ||
speed?: "fast" | "normal" | "slow"; | ||
pauseOnHover?: boolean; | ||
className?: string; | ||
}) => { | ||
const containerRef = React.useRef<HTMLDivElement>(null); | ||
const scrollerRef = React.useRef<HTMLUListElement>(null); | ||
const [start, setStart] = useState(false); | ||
|
||
useEffect(() => { | ||
if (!containerRef.current || !scrollerRef.current) return; | ||
|
||
// Clear existing clones | ||
while (scrollerRef.current.children.length > items.length) { | ||
scrollerRef.current.lastChild && | ||
scrollerRef.current.removeChild(scrollerRef.current.lastChild); | ||
} | ||
|
||
// Clone items just once for infinite scroll | ||
const originalItems = Array.from(scrollerRef.current.children).slice( | ||
0, | ||
items.length, | ||
); | ||
originalItems.forEach((item) => { | ||
const duplicatedItem = item.cloneNode(true); | ||
if (scrollerRef.current) { | ||
scrollerRef.current.appendChild(duplicatedItem); | ||
} | ||
}); | ||
|
||
const observer = new IntersectionObserver( | ||
(entries) => { | ||
entries.forEach((entry) => { | ||
if (entry.isIntersecting) { | ||
setStart(true); | ||
} | ||
}); | ||
}, | ||
{ threshold: 0.1 }, | ||
); | ||
|
||
observer.observe(containerRef.current); | ||
|
||
return () => { | ||
observer.disconnect(); | ||
}; | ||
}, [items]); | ||
|
||
// ... rest of the component stays the same ... | ||
}; |
154 changes: 154 additions & 0 deletions
154
apps/site/src/app/(main)/(home)/sections/Organizers/InfiniteMovingCards.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
"use client"; | ||
|
||
import React, { useEffect, useState } from "react"; | ||
import box from "@/assets/images/center_chat_box.svg"; | ||
import boxBG from "@/assets/images/center_chat_box_bg.svg"; | ||
import Link from "next/link"; | ||
import Image from "next/image"; | ||
|
||
export const InfiniteMovingCards = ({ | ||
items, | ||
direction = "left", | ||
speed = "fast", | ||
pauseOnHover = true, | ||
}: { | ||
items: { | ||
quote: string; | ||
name: string; | ||
title: string; | ||
image: string; | ||
link: string; | ||
}[]; | ||
direction?: "left" | "right"; | ||
speed?: "fast" | "normal" | "slow"; | ||
pauseOnHover?: boolean; | ||
className?: string; | ||
}) => { | ||
const containerRef = React.useRef<HTMLDivElement>(null); | ||
const scrollerRef = React.useRef<HTMLUListElement>(null); | ||
const [start, setStart] = useState(false); | ||
|
||
useEffect(() => { | ||
if (!containerRef.current || !scrollerRef.current) return; | ||
|
||
// Clone items multiple times to ensure smooth infinite scroll | ||
const scrollerContent = Array.from(scrollerRef.current.children); | ||
// Clone enough times to ensure continuous scroll | ||
scrollerContent.forEach((item) => { | ||
const duplicatedItem = item.cloneNode(true); | ||
if (scrollerRef.current) { | ||
scrollerRef.current.appendChild(duplicatedItem); | ||
} | ||
}); | ||
|
||
const observer = new IntersectionObserver( | ||
(entries) => { | ||
entries.forEach((entry) => { | ||
if (entry.isIntersecting) { | ||
setStart(true); | ||
} | ||
}); | ||
}, | ||
{ threshold: 0.1 }, | ||
); | ||
|
||
observer.observe(containerRef.current); | ||
|
||
return () => { | ||
observer.disconnect(); | ||
}; | ||
}, [items]); | ||
|
||
const duration = | ||
speed === "fast" ? "30s" : speed === "normal" ? "45s" : "270s"; | ||
|
||
return ( | ||
<div | ||
ref={containerRef} | ||
className="scroller relative z-[20] max-w-3xl overflow-hidden [mask-image:linear-gradient(to_right,transparent,white_20%,white_80%,transparent)] pt-28" | ||
style={ | ||
{ | ||
"--duration": duration, | ||
} as React.CSSProperties | ||
} | ||
> | ||
<ul | ||
ref={scrollerRef} | ||
className={`flex min-w-full shrink-0 gap-2 py-4 w-max flex-nowrap items-center justify-center ${ | ||
start ? "animate-scroll" : "" | ||
} ${pauseOnHover ? "hover:[animation-play-state:paused]" : ""} ${ | ||
direction === "right" ? "[animation-direction:reverse]" : "" | ||
}`} | ||
> | ||
{items.map((item, idx) => ( | ||
<li | ||
key={`${item.name}-${idx}`} | ||
className="relative flex-shrink-0 group" | ||
style={{ transform: "skew(-20deg)" }} | ||
> | ||
{/* Info popup on hover */} | ||
<div className="absolute -top-[110px] left-[12%] -translate-x-1/2 opacity-0 group-hover:opacity-100 z-[300] pointer-events-none transition-opacity"> | ||
<div | ||
className="relative w-[200px] h-[100px]" | ||
style={{ | ||
transform: "skew(20deg)", | ||
}} | ||
> | ||
{/* Background chat box - positioned slightly offset */} | ||
<div className="absolute inset-0 -right-1 -bottom-1"> | ||
<Image | ||
src={boxBG} | ||
alt="Box Background" | ||
className="w-full h-full object-contain" | ||
style={{ maxWidth: "100%" }} | ||
/> | ||
</div> | ||
|
||
{/* Main chat box */} | ||
<div className="absolute inset-0"> | ||
<Image | ||
src={box} | ||
alt="Box" | ||
className="w-full h-full object-contain" | ||
style={{ maxWidth: "100%" }} | ||
/> | ||
</div> | ||
|
||
<div className="absolute inset-0 flex flex-col items-center justify-center gap-0"> | ||
<p className="text-sm font-medium text-gray-200 leading-tight"> | ||
{item.name} | ||
</p> | ||
<p className="text-xs text-gray-400 leading-tight"> | ||
{item.title} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{/* Card */} | ||
<div className="relative w-16 h-20 bg-black border-2 border-white overflow-hidden transition-transform group-hover:scale-105 group-hover:bg-[#006FB2]"> | ||
<div | ||
className="absolute inset-0 bg-black group-hover:bg-[#006FB2]" | ||
style={{ transform: "skew(20deg) scale(1.2)" }} | ||
> | ||
<Link | ||
href={item.link} | ||
target="_blank" | ||
className="relative block w-full h-full" | ||
prefetch={false} | ||
> | ||
<img | ||
src={item.image} | ||
alt={item.name} | ||
className="object-cover w-full h-full opacity-75 group-hover:opacity-100" | ||
style={{ maxWidth: "100%" }} | ||
/> | ||
</Link> | ||
</div> | ||
</div> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; |
8 changes: 8 additions & 0 deletions
8
apps/site/src/app/(main)/(home)/sections/Organizers/Organizers.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@keyframes scroll { | ||
from { | ||
transform: translateX(0); | ||
} | ||
to { | ||
transform: translateX(calc(-50%)); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'start' is assigned a value but never used.