Skip to content
This repository was archived by the owner on Feb 9, 2025. It is now read-only.

Commit 385d37f

Browse files
committed
fix: managing dao hero background adjusts to mobile and desktop size
1 parent f2d1f0a commit 385d37f

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/components/Introduction.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Image from 'next/image';
22
import Link from 'next/link';
3+
import { useMediaQuery } from 'react-responsive';
34

4-
// import { useMediaQuery } from 'react-responsive';
55
import trackClick from '@/lib/trackClick';
66

77
import * as Anchor from '@/components/Anchor';
@@ -11,19 +11,17 @@ import Icon from '@/components/Icon';
1111
import Text from '@/components/Text';
1212

1313
export default function Introduction() {
14-
// const isNarrow = useMediaQuery({ query: `(max-width: 834px)` });
15-
// const imgClass = isNarrow
16-
// ? 'absolute -top-[295px] left-1/2 -z-10 h-[844px] w-[1800px] -translate-x-[640px]'
17-
// : 'absolute -top-[275px] left-1/2 -z-10 h-[844px] w-[1800px] -translate-x-[1072px]';
14+
const isNarrow = useMediaQuery({ query: `(max-width: 834px)` });
15+
const imgClass = isNarrow
16+
? 'absolute -top-[295px] left-1/2 -z-10 h-[844px] w-[1800px] -translate-x-[640px]'
17+
: 'absolute -top-[275px] left-1/2 -z-10 h-[844px] w-[1800px] -translate-x-[1072px]';
1818

1919
return (
20-
// <div className='relative'>
21-
// <div className={imgClass}>
2220
// The page gets sized by the overflowing hero image. To keep the page
2321
// width from being affected by the hero, we need to add an
2422
// 'overflow-hidden' to the container div
2523
<div className='relative overflow-hidden'>
26-
<div className='absolute -top-[275px] left-1/2 -z-10 h-[844px] w-[1800px] -translate-x-1/2'>
24+
<div className={imgClass}>
2725
<Image
2826
priority
2927
className='w-full'

src/components/ManagingDAOs/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Image from 'next/image';
2+
import { useMediaQuery } from 'react-responsive';
23

34
import clsxm from '@/lib/clsxm';
45

@@ -9,15 +10,19 @@ import CONFIG from './config';
910
import Section from './Section';
1011

1112
export default function ManagingDAOs() {
13+
const isNarrow = useMediaQuery({ query: `(max-width: 834px)` });
14+
const imgClass = isNarrow
15+
? 'absolute -z-10 top-0 -left-[800px] bottom-0 -right-60 bg-[#201F27]'
16+
: 'absolute -z-10 h-full w-full bg-[#201F27]';
17+
1218
return (
13-
<div className='relative'>
14-
<div className='absolute -z-10 h-full w-full bg-[#201F27]'>
19+
<div className='relative overflow-hidden'>
20+
<div className={imgClass}>
1521
<Image
1622
className='w-full'
1723
alt='hero image'
1824
src='/backgrounds/managing-dao.png'
1925
layout='fill'
20-
objectFit='cover'
2126
/>
2227
</div>
2328
<CenteredContent className='px-5'>

0 commit comments

Comments
 (0)