Skip to content
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

Devcon 7 - Design updates #278

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions app/[lang]/devcon-7/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from "react"
import { Metadata } from "next"
import React from 'react'
import { Metadata } from 'next'

import { Devcon7Booths } from "./sections/Devcon7Booths"
import { Devcon7Header } from "./sections/Devcon7Header"
import { Devcon7Section } from "./sections/Devcon7Section"
import { Devcon7Booths } from './sections/Devcon7Booths'
import { Devcon7Header } from './sections/Devcon7Header'
import { Devcon7Section } from './sections/Devcon7Section'

export const metadata: Metadata = {
title: "Devon 7",
description: "PSE x Devcon 7 Southeast Asia",
title: 'Devon 7',
description: 'PSE x Devcon 7 Southeast Asia',
openGraph: {
images: [
{
url: "/devcon-7-cover.png",
url: '/devcon-7-cover.png',
width: 1200,
height: 630,
},
Expand All @@ -25,7 +25,6 @@ export default async function DevconPage() {
<div className="flex flex-col lg:pb-[120px]">
<Devcon7Header />
<div className="flex flex-col gap-10 lg:gap-14 pt-8 lg:pt-[60px] mx-auto max-w-[950px]">
<Devcon7Booths />
<Devcon7Section />
</div>
</div>
Expand Down
206 changes: 142 additions & 64 deletions app/[lang]/devcon-7/sections/Devcon7Section.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
"use client"
'use client'

import { useState } from "react"
import Link from "next/link"
import { events } from "@/data/events/devcon-7"
import { cva } from "class-variance-authority"
import { useEffect, useState } from 'react'
import Link from 'next/link'
import { events } from '@/data/events/devcon-7'
import { cva } from 'class-variance-authority'
import { Button } from '@/components/ui/button'
import { useTranslation } from '@/app/i18n/client'

import { cn } from "@/lib/utils"
import { Icons } from "@/components/icons"
import { cn } from '@/lib/utils'
import { Icons } from '@/components/icons'

const tableSection = cva("lg:grid lg:grid-cols-[200px_1fr_160px_20px] lg:gap-8")
const tableSection = cva('lg:grid lg:grid-cols-[200px_1fr_160px_20px] lg:gap-8')
const tableSectionTitle = cva(
"text-anakiwa-500 text-base lg:text-xs font-sans leading-5 tracking-[2.5px] uppercase font-bold lg:pb-3"
'text-anakiwa-500 text-base lg:text-xs font-sans leading-5 tracking-[2.5px] uppercase font-bold lg:pb-3'
)

const EventCard = ({ event = {}, speakers = [], location = "" }: any) => {
const EventCard = ({ event = {}, speakers = [], location = '' }: any) => {
const [isOpen, setIsOpen] = useState(false)

const getYouTubeEmbedURL = (url: string) => {
const match = url.match(
/(?:youtube\.com\/(?:watch\?v=|live\/)|youtu\.be\/)([^?&]+)/
)
return match ? `https://www.youtube.com/embed/${match[1]}` : null
}

return (
<div
className={cn(
"flex flex-col gap-3",
'flex flex-col gap-3',
tableSection(),
"py-4 px-6 lg:p-0 lg:pt-[30px] lg:pb-5 border-b border-b-tuatara-200"
'py-4 px-6 lg:p-0 lg:pt-[30px] lg:pb-5 border-b border-b-tuatara-200'
)}
>
<div className="flex flex-col gap-1 order-3 lg:order-1">
Expand All @@ -42,88 +51,157 @@ const EventCard = ({ event = {}, speakers = [], location = "" }: any) => {
{location}
</span>
</div>
<div className="flex flex-wrap lg:flex-col gap-1 pt-1">
{speakers?.map((speaker: any, index: number) => {
return (
<Link
key={index}
className="text-sm text-anakiwa-500 underline break-all"
href={speaker.url ?? '#'}
>
{speaker.label}
</Link>
)
})}
</div>
</div>
</div>
</div>
<div className="flex flex-col gap-[10px] lg:order-2 order-2">
<Link
href={event?.url ?? "#"}
target="_blank"
className="text-[22px] leading-[24px] text-tuatara-950 underline font-display hover:text-anakiwa-500 font-bold duration-200"
>
{event?.title}
</Link>
<div className="flex flex-col justify-start gap-[10px] lg:order-2 order-2">
<div className="flex items-center justify-between">
<Link
href={event?.url ?? '#'}
target="_blank"
className="text-[22px] inline-flex leading-[24px] text-tuatara-950 underline font-display hover:text-anakiwa-500 font-bold duration-200"
>
{event?.title}
</Link>
<button
className="lg:hidden flex"
onClick={() => {
setIsOpen(!isOpen)
}}
>
{isOpen ? (
<Icons.minus
className={cn(
'size-5 ml-auto',
'transition-transform duration-200'
)}
/>
) : (
<Icons.plus
className={cn(
'size-5 ml-auto',
'transition-transform duration-200'
)}
/>
)}
</button>
</div>
<div
className={cn(
"lg:max-h-none lg:opacity-100 lg:block",
"transition-all duration-300 overflow-hidden",
isOpen ? "max-h-[1000px] opacity-100" : "max-h-0 opacity-0",
"lg:transition-none lg:overflow-visible"
'lg:max-h-none lg:opacity-100 lg:block',
'transition-all duration-300 overflow-hidden',
isOpen ? 'max-h-[1000px] opacity-100' : 'max-h-0 opacity-0',
'lg:transition-none lg:overflow-visible'
)}
>
<span className="text-base leading-6 text-tuatara-950 font-sans font-normal">
{event?.description}
</span>
<div className="pt-2 flex lg:!hidden">
{event?.youtubeLink && (
<iframe
width="100%"
height="230"
src={getYouTubeEmbedURL(event?.youtubeLink) ?? ''}
allowFullScreen
style={{ borderRadius: '10px', overflow: 'hidden' }}
/>
)}
</div>
</div>
</div>

<div className="lg:order-3 order-1 grid gap-5 pb-3 lg:pb-0 grid-cols-[1fr_32px] lg:grid-cols-1">
<div className="flex flex-wrap lg:flex-col gap-1">
{speakers?.map((speaker: any, index: number) => {
return (
<Link
key={index}
className="text-sm text-anakiwa-500 underline break-all"
href={speaker.url ?? "#"}
>
{speaker.label}
</Link>
)
})}
</div>
<button
className="lg:hidden flex"
onClick={() => {
setIsOpen(!isOpen)
}}
>
{isOpen ? (
<Icons.minus
className={cn(
"size-5 ml-auto",
"transition-transform duration-200"
)}
/>
) : (
<Icons.plus
className={cn(
"size-5 ml-auto",
"transition-transform duration-200"
)}
<div className="relative lg:order-3 grid gap-5 pb-3 lg:pb-0 grid-cols-[1fr_32px] lg:grid-cols-1">
<div className="hidden lg:flex flex-wrap lg:flex-col gap-1">
{event?.youtubeLink && (
<iframe
width="240"
height="140"
src={getYouTubeEmbedURL(event?.youtubeLink) ?? ''}
allowFullScreen
style={{ borderRadius: '10px', overflow: 'hidden' }}
/>
)}
</button>
</div>
</div>

<div className="order-4 lg:flex hidden"></div>
</div>
)
}

export const Devcon7Section = () => {
export const Devcon7Section = ({ lang }: any) => {
const [showAll, setShowAll] = useState(false)
const { t } = useTranslation(lang, 'devcon-7')
const [isMobile, setIsMobile] = useState(false)

const images = [
'/images/devcon-7/devcon-7-overview-1.jpg',
'/images/devcon-7/devcon-7-overview-2.jpg',
'/images/devcon-7/devcon-7-overview-3.jpg',
'/images/devcon-7/devcon-7-overview-4.jpg',
'/images/devcon-7/devcon-7-overview-5.jpg',
'/images/devcon-7/devcon-7-overview-6.jpg',
]

useEffect(() => {
setIsMobile(window?.innerWidth < 1024)
}, [])

// Show only 1 image on mobile, all images on desktop
const visibleImages = showAll ? images : images.slice(0, 1)

return (
<div className="flex flex-col gap-10 relative">
<div className="flex flex-col lg:container">
<div className="flex flex-col gap-3 lg:gap-10 lg:container">
<div className="grid grid-cols-1 lg:grid-cols-3 gap-2 lg:pt-10 container lg:!px-0">
{/* Show all images on desktop, filtered images on mobile */}
{(!isMobile ? images : visibleImages).map((image, index) => (
<div
key={index}
className="h-[230px] w-full rounded-[10px] bg-cover aspect-video bg-center"
style={{ backgroundImage: `url(${image})` }}
/>
))}
{/* Show button only on mobile when there are hidden images */}
{!showAll && images.length > 1 && (
<Button
onClick={() => setShowAll(true)}
className="lg:hidden col-span-1 mt-2"
variant="outline"
size="sm"
>
show more
</Button>
)}
</div>
{/* Table header is hidden following new design */}
<div
className={cn(tableSection(), "lg:border-b lg:border-anakiwa-200")}
className={cn(
tableSection(),
'!hidden lg:border-b lg:border-anakiwa-200'
)}
>
<div className={cn(tableSectionTitle(), "lg:flex hidden")}>
<div className={cn(tableSectionTitle(), 'lg:flex hidden')}>
Details
</div>
<div className={cn(tableSectionTitle(), "lg:text-left text-center")}>
<div className={cn(tableSectionTitle(), 'lg:text-left text-center')}>
Talks
</div>
<div className={cn(tableSectionTitle(), "lg:flex hidden")}>
<div className={cn(tableSectionTitle(), 'lg:flex hidden')}>
Speakers
</div>
<div className="lg:flex hidden"></div>
Expand Down
Loading