Skip to content

Commit

Permalink
responsiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
cchrischen committed Aug 9, 2024
1 parent 9414e18 commit 3b76bfd
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 44 deletions.
84 changes: 66 additions & 18 deletions new-dti-website/components/sponsor/SponsorshipTable.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,100 @@
import { useState } from 'react';
import { benefits } from './data/benefits.json';
import { medals } from './data/medals.json';
import benefitData from './data/benefits.json';
import medalData from './data/medals.json';
import useScreenSize from '../../src/hooks/useScreenSize';
import { TABLET_BREAKPOINT } from '../../src/consts';

type Tier = 'bronze' | 'silver' | 'gold' | 'platinum';

const { medals } = medalData;
const { benefits } = benefitData;

const tiers = Object.keys(medals);

const SponsorshipTableMobile = () => {
const [medal, setMedal] = useState<Tier>('bronze');
return <div></div>;
const [selectedMedal, setSelectedMedal] = useState<Tier>('bronze');
return (
<>
<div className="flex flex-col gap-7 pb-6 border-b-2 border-black">
<h3 className="font-semibold text-2xl">Sponsorship benefits</h3>
<div className="flex h-fit justify-between">
{Object.keys(medals).map((medal) => (
<div className="flex justify-center items-center" key={medal}>
<img
src={medals[medal as Tier][selectedMedal === medal ? 'sticker' : 'shadow']}
alt={medal}
onClick={() => setSelectedMedal(medal as Tier)}
height={selectedMedal === medal ? 100 : 87}
/>
</div>
))}
</div>
</div>
<div>
{benefits.map((benefit) => {
const highlighted = tiers.indexOf(selectedMedal) >= tiers.indexOf(benefit.lowestTier);
return (
<div className="flex py-3 gap-x-4 border-b-[1px] border-[#D3C4C4]" key={benefit.key}>
<img
src={`/icons/${highlighted ? 'green_check' : 'red_x'}.svg`}
alt={highlighted ? 'check' : 'x'}
/>
<div className={`flex flex-col gap-1 ${highlighted ? 'opacity-100' : 'opacity-50'}`}>
<h4 className="text-lg text-[#0C0404]">{benefit.title}</h4>
<p className="text-sm text-[#877B7B] ">{benefit.description}</p>
</div>
</div>
);
})}
</div>
</>
);
};

const SponsorshipTableLaptop = () => (
<>
<div className="flex justify-between pb-3 border-b-2 border-black">
<h3 className="font-semibold flex items-center text-[32px]">Sponsorship benefits</h3>
<h3 className="font-semibold flex items-center lg:text-[32px] md:text-2xl">
Sponsorship benefits
</h3>
<div className="flex justify-evenly">
{Object.keys(medals).map((medal) => (
<div className="w-[130px] flex justify-center">
<img src={medals[medal as Tier].standard} alt={medal} className="" key={medal} />
<div className="lg:w-[130px] md:w-28 flex justify-center" key={medal}>
<img src={medals[medal as Tier].standard} alt={medal} key={medal} />
</div>
))}
</div>
</div>
{benefits.map((benefit) => (
<div key={benefit.key} className="flex justify-between py-5 border-b-[1px] border-[#D3C4C4]">
<div className="flex flex-col gap-1">
<h4 className="text-[22px]">{benefit.title}</h4>
<p className="text-[#877B7B] text-lg">{benefit.description}</p>
<h4 className="text-[#0C0404] lg:text-[22px] md:text-lg">{benefit.title}</h4>
<p className="text-[#877B7B] lg:text-lg md:text-sm">{benefit.description}</p>
</div>
<div className="flex">
{tiers.map((n) => (
<div className="w-[130px] flex justify-center" key={`${benefit.key}-${n}`}>
{tiers.indexOf(n) >= tiers.indexOf(benefit.lowestTier) && (
{tiers.map((tier) => (
<div
className="lg:w-[130px] md:w-28 flex justify-center"
key={`${benefit.key}-${tier}`}
>
{tiers.indexOf(tier) >= tiers.indexOf(benefit.lowestTier) && (
<img src="/icons/check.svg" alt="check" className="w-[30px]" />
)}
</div>
))}
</div>
</div>
))}
<div className="h-[200px]"></div>
</>
);

const SponsorshipTable = () => (
<div className="max-w-5xl w-full flex flex-col justify-center my-24">
<SponsorshipTableLaptop />
</div>
);
const SponsorshipTable = () => {
const { width } = useScreenSize();
return (
<div className="max-w-5xl w-full flex flex-col justify-center lg:my-24 md:my-14 xs:my-10 p-5">
{width >= TABLET_BREAKPOINT ? <SponsorshipTableLaptop /> : <SponsorshipTableMobile />}
</div>
);
};

export default SponsorshipTable;
9 changes: 9 additions & 0 deletions new-dti-website/public/icons/company-icons/asana.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions new-dti-website/public/icons/company-icons/invision.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions new-dti-website/public/icons/company-icons/millennium.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions new-dti-website/public/icons/company-icons/zeplin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions new-dti-website/public/icons/green_check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions new-dti-website/public/icons/red_x.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 43 additions & 26 deletions new-dti-website/src/app/sponsor/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
'use client'
'use client';

import { impacts } from '../../../components/sponsor/data/impacts.json';
import { companies } from '../../../components/sponsor/data/sponsors.json';
import impactData from '../../../components/sponsor/data/impacts.json';
import companyData from '../../../components/sponsor/data/sponsors.json';
import SponsorshipTable from '../../../components/sponsor/SponsorshipTable';

const { impacts } = impactData;
const { companies } = companyData;

const SponsorHero = () => (
<div className="bg-black text-white md:my-[100px] xs:my-9 min-h-[calc(100vh-336px)]">
<div
className="bg-black text-white md:my-[100px] xs:my-9 min-h-[calc(100vh-336px)]
flex items-center"
>
<div
className="flex lg:flex-row xs:flex-col w-10/12 gap-y-9 relative z-10
lg:ml-[152px] md:ml-10 xs:ml-9"
className="flex lg:flex-row xs:flex-col w-10/12 gap-y-9 gap-x-24 relative z-10
lg:mx-32 md:mx-10 xs:mx-9"
>
<div className="mr-20">
<div>
<h1
className="font-semibold md:text-[100px] xs:text-[52px] md:leading-[120px]
xs:leading-[63px] w-[550px]"
xs:leading-[63px] whitespace-pre"
>
SUPPORT <span className="text-[#FF4C4C]">OUR TEAM</span>
SUPPORT <br />
<span className="text-[#FF4C4C]">OUR TEAM</span>
</h1>
</div>
<div className="flex flex-col justify-center gap-6">
Expand All @@ -42,30 +49,34 @@ type SponsorCardProps = {
image: string;
title: string;
description: string;
key: string;
alt: string;
};

const SponsorCard: React.FC<SponsorCardProps> = ({ image, title, description, key }) => (
<div key={key} className="flex flex-col gap-3 w-[308px]">
<img src={image} alt={key} className="h-[112px]" />
const SponsorCard: React.FC<SponsorCardProps> = ({ image, title, description, alt }) => (
<div className="flex flex-col gap-3 lg:w-[308px] md:w-60 max-w-lg">
<img src={image} alt={alt} className="h-[112px]" />
<div
className="bg-white p-6 flex flex-col gap-3 rounded-2xl"
style={{ boxShadow: '4px 4px 8px 2px #00000014' }}
>
<h3 className="font-semibold text-xl text-center">{title}</h3>
<p className="text-lg">{description}</p>
<h3 className="font-semibold lg:text-xl xs:text-lg text-center">{title}</h3>
<p className="lg:text-lg xs:text-sm">{description}</p>
</div>
</div>
);

const SponsorImpact = () => (
<div className="max-w-5xl flex gap-12 py-24">
<div
className="max-w-5xl flex lg:gap-x-12 xs:gap-y-10 xs:gap-x-3 lg:py-24 xs:py-14 xs:flex-col
md:flex-row p-5 items-center"
>
{impacts.map((impact) => (
<SponsorCard
image={impact.image}
title={impact.title}
description={impact.description}
key={impact.key}
alt={impact.key}
/>
))}
</div>
Expand All @@ -75,9 +86,13 @@ const SponsorPage = () => (
<>
<SponsorHero />
<div className="bg-[#EDEDED] flex justify-center">
<div className="max-w-5xl flex justify-center py-14 gap-20">
<img src="/images/dti_2024.png" alt="DTI 2024" className="rounded-3xl w-[475px] h-auto" />
<div className="flex flex-col justify-center gap-5">
<div className="max-w-5xl flex justify-center p-5 py-14 lg:gap-20 md:gap-10 xs:gap-5 md:flex-row xs:flex-col">
<img
src="/images/dti_2024.png"
alt="DTI 2024"
className="rounded-3xl lg:w-[475px] xs:w-[350px] h-auto mx-auto"
/>
<div className="flex flex-col justify-center md:gap-5 xs:gap-3">
<h3 className="font-semibold text-2xl">Become a sponsor!</h3>
<p className="text-lg">
We would love to partner with organizations that share our vision of changing the world.
Expand All @@ -90,7 +105,7 @@ const SponsorPage = () => (
className="rounded-xl py-3 px-[14px] bg-[#A52424] text-white
font-bold hover:bg-white hover:text-[#A52424] w-fit"
>
Contact us
<a href="mailto:hello@cornelldti.org">Contact us</a>
</button>
</div>
</div>
Expand All @@ -99,21 +114,23 @@ const SponsorPage = () => (
<SponsorImpact />
<SponsorshipTable />
</div>
<div className="bg-[#EDEDED] flex flex-col items-center gap-7 py-[100px]">
<h3 className="font-semibold text-[32px]">Thank you to our sponsors!</h3>
<div className="flex gap-6">
<div className="bg-[#EDEDED] flex flex-col items-center gap-7 lg:py-[100px] xs:py-[60px] md:px-20 xs:px-5">
<h3 className="font-semibold md:text-[32px] xs:text-2xl">Thank you to our sponsors!</h3>
<div className="grid gap-6 md:grid-cols-6 xs:grid-cols-3 items-center">
{companies.map((company) => (
<img src={company.icon} alt={company.key} key={company.key} width={company.width} />
))}
</div>
</div>
<div className="bg-[#F6F6F6] flex flex-col items-center gap-5 py-[60px]">
<p className="text-[22px]">Want to learn more about how you can help us make an impact?</p>
<div className="bg-[#F6F6F6] flex flex-col items-center gap-5 py-[60px] px-10">
<p className="lg:text-[22px] xs:text-lg text-center">
Want to learn more about how you can help us make an impact?
</p>
<button
className="rounded-xl py-3 px-[14px] bg-[#A52424] text-white
font-bold hover:bg-white hover:text-[#A52424] w-fit"
>
Contact us
<a href="mailto:hello@cornelldti.org">Contact us</a>
</button>
</div>
</>
Expand Down

0 comments on commit 3b76bfd

Please sign in to comment.