Skip to content

Commit

Permalink
fix: mobile sponsors button, center cards always
Browse files Browse the repository at this point in the history
  • Loading branch information
elegantShock2258 committed Dec 14, 2023
1 parent e8aca4c commit 090cc47
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 20 deletions.
12 changes: 7 additions & 5 deletions src/app/sponsors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Image from 'next/image';
import astronaut from '../../assets/images/astronaut.svg';

export default function Sponsors() {
const sponsorsList: SponsorCardProps[] = [];
const sponsorsList: SponsorCardProps[] = Array(30).fill({ name: 'nextjs', logo: '/next.svg' });

// backend logic
// sponsorsList = await(await fetch("backend url",{next:{tags:['collection']}})).json();
Expand All @@ -23,10 +23,12 @@ export default function Sponsors() {
<SponsorButton />
</div>
<div className={styles.sponsorText}>SPONSORS</div>
<div className={styles.sponsorList}>
{sponsorsList.map((e: SponsorCardProps) => (
<SponsorCard name={e.name} logo={e.logo} key={e.name} />
))}
<div className={styles.parentList}>
<div className={styles.sponsorList}>
{sponsorsList.map((e: SponsorCardProps) => (
<SponsorCard name={e.name} logo={e.logo} key={e.name} />
))}
</div>
</div>
</>
) : (
Expand Down
25 changes: 22 additions & 3 deletions src/app/sponsors/sponsors.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
height: min-content;

@media screen and (max-width:560px) {
transform: translate(10%, -85%);
transform: translate(10%, -05%);
margin-top: 60px;
}
}
Expand Down Expand Up @@ -120,6 +120,7 @@
display: flex;
justify-content: center;
align-items: center;

@media screen and (max-width:560px) {
transform: translate(10%, -45%);
margin-top: 60px;
Expand All @@ -131,21 +132,39 @@
display: flex;
flex-wrap: wrap;
max-height: 100%;
overflow-y: scroll;
width: fit-content;
height: fit-content;
overflow-x: hidden;

gap: 115px;
justify-content: center;

@media screen and (max-width:560px) {
flex-wrap: nowrap;
flex-direction: column;
align-items: center;
gap:5px;
gap: 5px;
}
}

.astro {
overflow: hidden;
min-width: 220px !important;

@media screen and (max-width:560px) {
display: none;
}
}

.parentList {
padding: 50px;
display: flex;
justify-content: center;
align-items: center;
overflow-y: scroll;


}
.parentList::-webkit-scrollbar {
display: none;
}
2 changes: 1 addition & 1 deletion src/assets/images/top-left-border.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/images/top-right-border.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/SponsorCard/SponsorCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { motion } from 'framer-motion';
import { useEffect, useState } from 'react';

const SponsorCard = ({ name, logo }: SponsorCardProps) => {
const [dim, setDim] = useState(0.75);
const [dim, setDim] = useState(1);
useEffect(() => {
setDim(window.innerWidth < 560 ? 0.65 : 0.75);
setDim(window.innerWidth < 560 ? 0.65 : 1);
}, []);
return (
<motion.div className={styles.parent} initial={{ scale: dim }}>
Expand Down
18 changes: 10 additions & 8 deletions src/components/SponsorCard/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

.borderOverlay,
.sponsorParent {
width: 455px;
height: 340px;
width: 341px;
height:255px;
grid-area: 1/1;
}

Expand All @@ -34,8 +34,8 @@
}

.title {
width: 425px;
height: 85px;
width: 318px;
height: 64px;
flex-shrink: 0;
transform: translateY(-15%);
background: rgba(57, 158, 184, 0.5);
Expand All @@ -52,8 +52,8 @@
font-style: normal;
font-weight: 400;
line-height: normal;
width: 405px;
height: 65px;
width: 304px;
height: 49px;
flex-shrink: 0;
border: 5px solid rgba(255, 255, 255, 0.5);
display: flex;
Expand All @@ -62,13 +62,15 @@
}

.body {
width: 425px;
height: 195px;
width: 319px;
height: 146px;
flex-shrink: 0;

border: 0.5px solid #fff;
background: rgba(2, 33, 41, 0.5);
display: flex;
justify-content: center;
align-items: center;

padding: 10px;
}

0 comments on commit 090cc47

Please sign in to comment.