-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: remove lineHeight whitespace * feat: mobile about * feat: tablet about Fixing Typescript "Cannot find module" for svg assets: [svgr d.ts](gregberge/svgr#551 (comment)) * feat: desktop about
- Loading branch information
1 parent
a8e30b5
commit 3ec11cd
Showing
8 changed files
with
306 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
declare module '*.svg?url' { | ||
import type { ComponentType, SVGProps } from 'react'; | ||
|
||
type SvgComponent = ComponentType<SVGProps>; | ||
|
||
const Svg: SvgComponent; | ||
|
||
export = Svg; | ||
} |
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
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,159 @@ | ||
import Box from '@mui/material/Box'; | ||
import { styled } from '@mui/material/styles'; | ||
import React from 'react'; | ||
|
||
import desktopEnjoyablePlaceSm from '@/assets/homepage/enjoyable-place-desktop.jpg'; | ||
import desktopEnjoyablePlaceMd from '@/assets/homepage/[email protected]'; | ||
import mobileEnjoyablePlaceSm from '@/assets/homepage/enjoyable-place-mobile.jpg'; | ||
import mobileEnjoyablePlaceMd from '@/assets/homepage/[email protected]'; | ||
import tabletEnjoyablePlaceSm from '@/assets/homepage/enjoyable-place-tablet.jpg'; | ||
import tabletEnjoyablePlaceMd from '@/assets/homepage/[email protected]'; | ||
import desktopLocallySourceSm from '@/assets/homepage/locally-sourced-desktop.jpg'; | ||
import desktopLocallySourceMd from '@/assets/homepage/[email protected]'; | ||
import mobileLocallySourceSm from '@/assets/homepage/locally-sourced-mobile.jpg'; | ||
import mobileLocallySourceMd from '@/assets/homepage/[email protected]'; | ||
import tabletLocallySourceSm from '@/assets/homepage/locally-sourced-tablet.jpg'; | ||
import tabletLocallySourceMd from '@/assets/homepage/[email protected]'; | ||
import patternCurveTopLeft from '@/assets/patterns/pattern-curve-top-left.svg?url'; | ||
import patternCurveTopRight from '@/assets/patterns/pattern-curve-top-right.svg?url'; | ||
import patternLines from '@/assets/patterns/pattern-lines.svg?url'; | ||
|
||
import InfoCard from './InfoCard'; | ||
|
||
const StyledBox = styled(Box)(({ theme }) => ({ | ||
[theme.breakpoints.up('tablet')]: { | ||
position: 'relative', | ||
'&::before, &::after': { | ||
content: '""', | ||
width: 895, // default svg width | ||
height: 320, // default svg height | ||
backgroundImage: `url(${patternCurveTopRight})`, | ||
position: 'absolute', | ||
top: 196, | ||
left: -516, // svgWidth - (tabletSize / 2) + adjustment | ||
zIndex: 1, | ||
}, | ||
'&::after': { | ||
backgroundImage: `url(${patternCurveTopLeft})`, | ||
top: 'revert', | ||
left: 'revert', | ||
right: -511, // svgWidth - (tabletSize / 2) | ||
bottom: -118, // Last InfoCard bottom margin | ||
}, | ||
'.bg-pattern::after': { | ||
content: '""', | ||
width: 160, // default svg width | ||
height: 76, // default svg height | ||
backgroundImage: `url(${patternLines})`, | ||
position: 'absolute', | ||
top: 228, | ||
left: 471, | ||
zIndex: 5, | ||
}, | ||
[theme.breakpoints.up('desktop')]: { | ||
width: 1110, | ||
marginInline: 'auto', | ||
|
||
'&::before': { | ||
left: -165, | ||
top: 320, | ||
}, | ||
'&::after': { | ||
right: -165, | ||
bottom: 0, | ||
}, | ||
'.bg-pattern picture': { | ||
marginBottom: -80, | ||
}, | ||
'.bg-pattern::after': { | ||
left: 1064, | ||
top: 282, | ||
}, | ||
}, | ||
}, | ||
})); | ||
|
||
const About: React.FC = () => { | ||
const enjoyablePlace = { | ||
title: 'Enjoyable place for all the family', | ||
description: ` | ||
Our relaxed surroundings make dining with us a great experience for everyone. We can even arrange | ||
a tour of the farm before your meal. | ||
`, | ||
img: { | ||
src: mobileEnjoyablePlaceSm.src, | ||
alt: 'Country landscape', | ||
sources: [ | ||
{ | ||
srcSet: desktopEnjoyablePlaceMd.src, | ||
media: '(min-width: 1920px)', | ||
}, | ||
{ | ||
srcSet: desktopEnjoyablePlaceSm.src, | ||
media: '(min-width: 1440px)', | ||
}, | ||
{ | ||
srcSet: tabletEnjoyablePlaceMd.src, | ||
media: '(min-width: 900px)', | ||
}, | ||
{ | ||
srcSet: tabletEnjoyablePlaceSm.src, | ||
media: '(min-width: 768px)', | ||
}, | ||
{ | ||
srcSet: mobileEnjoyablePlaceMd.src, | ||
media: '(min-width: 400px)', | ||
}, | ||
], | ||
}, | ||
}; | ||
const locallySourcedFood = { | ||
title: 'The most locally sourced food', | ||
description: ` | ||
All our ingredients come directly from our farm or local fishery. So you can be sure that you're eating | ||
the freshest, most sustainable food. | ||
`, | ||
img: { | ||
src: mobileLocallySourceSm.src, | ||
alt: 'Country landscape', | ||
sources: [ | ||
{ | ||
srcSet: desktopLocallySourceMd.src, | ||
media: '(min-width: 1920px)', | ||
}, | ||
{ | ||
srcSet: desktopLocallySourceSm.src, | ||
media: '(min-width: 1440px)', | ||
}, | ||
{ | ||
srcSet: tabletLocallySourceMd.src, | ||
media: '(min-width: 900px)', | ||
}, | ||
{ | ||
srcSet: tabletLocallySourceSm.src, | ||
media: '(min-width: 768px)', | ||
}, | ||
{ | ||
srcSet: mobileLocallySourceMd.src, | ||
media: '(min-width: 400px)', | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
return ( | ||
<StyledBox> | ||
<InfoCard | ||
sx={{ | ||
marginTop: { mobile: '-72px', tablet: '-96px', desktop: '-70px' }, | ||
marginBottom: { desktop: '121px' }, | ||
}} | ||
{...enjoyablePlace} | ||
/> | ||
|
||
<InfoCard className="bg-pattern" {...locallySourcedFood} /> | ||
</StyledBox> | ||
); | ||
}; | ||
|
||
export default About; |
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,113 @@ | ||
import Card, { CardProps } from '@mui/material/Card'; | ||
import CardContent from '@mui/material/CardContent'; | ||
import CardMedia from '@mui/material/CardMedia'; | ||
import { styled } from '@mui/material/styles'; | ||
import Typography from '@mui/material/Typography'; | ||
import React from 'react'; | ||
|
||
import Container from '@/components/Container'; | ||
|
||
type Props = CardProps & { | ||
title: string; | ||
description: string; | ||
img: { | ||
src: string; | ||
alt: string; | ||
sources: { | ||
srcSet: string; | ||
media: string; | ||
}[] | ||
} | ||
} | ||
|
||
const StyledCard = styled(Card)(({ theme }) => ({ | ||
marginInline: theme.spacing(3), | ||
marginBottom: 101, | ||
overflow: 'revert', // Prevent square box shadow | ||
position: 'relative', | ||
|
||
[theme.breakpoints.up('tablet')]: { | ||
marginInline: 'auto', | ||
marginBottom: 118, | ||
maxWidth: 573, | ||
}, | ||
[theme.breakpoints.up('desktop')]: { | ||
display: 'grid', | ||
gridTemplateColumns: '540px 445px', | ||
gridAutoFlow: 'column', | ||
gridGap: 125, | ||
alignItems: 'center', | ||
margin: 'revert', | ||
|
||
'&:nth-of-type(even)': { | ||
gridTemplateColumns: '445px 540px', | ||
picture: { | ||
gridColumn: '2', | ||
}, | ||
}, | ||
}, | ||
})); | ||
|
||
const StyledCardMedia = styled(CardMedia)(() => ({ | ||
boxShadow: '0 75px 100px -50px rgba(56, 66, 85, 0.5)', | ||
position: 'relative', | ||
zIndex: 5, | ||
})) as typeof CardMedia; | ||
|
||
const StyledCardContent = styled(CardContent)(({ theme }) => ({ | ||
padding: 'revert', | ||
'&:last-child': { | ||
padding: 'revert', | ||
}, | ||
|
||
[theme.breakpoints.up('tablet')]: { | ||
maxWidth: 457, | ||
marginInline: 'auto', | ||
}, | ||
})); | ||
|
||
const InfoCard: React.FC<Props> = ({ img, title, description, ...props }) => { | ||
return ( | ||
<StyledCard elevation={0} {...props}> | ||
<picture> | ||
{img.sources.map((source, i) => ( | ||
<source key={`${img.alt}-${i}`} srcSet={source.srcSet} media={source.media} /> | ||
))} | ||
<StyledCardMedia component="img" src={img.src} alt={img.alt} /> | ||
</picture> | ||
|
||
<Container | ||
sx={{ | ||
marginTop: { mobile: 6.375, tablet: 7 }, | ||
textAlign: { mobile: 'center', desktop: 'revert' }, | ||
}} | ||
disableGutters | ||
> | ||
<StyledCardContent> | ||
<Typography | ||
variant="h2" | ||
fontSize={{ mobile: '2rem', tablet: '3rem' }} | ||
lineHeight={{ mobile: '2.5rem', tablet: '3rem' }} | ||
letterSpacing={{ mobile: '-0.003rem', tablet: '-0.031rem' }} | ||
px={{ mobile: 4, tablet: 4.25, desktop: 'revert' }} | ||
pr={{ desktop: 6.75 }} | ||
mt={{ mobile: 4.5, tablet: 4.875, desktop: 6.875 }} | ||
mb={{ mobile: 1.625, tablet: 3.375 }} | ||
> | ||
{title} | ||
</Typography> | ||
|
||
<Typography | ||
variant="body2" | ||
fontSize={{ tablet: '1.25rem' }} | ||
lineHeight={{ mobile: '1.625rem', tablet: '1.875rem' }} | ||
> | ||
{description} | ||
</Typography> | ||
</StyledCardContent> | ||
</Container> | ||
</StyledCard> | ||
); | ||
}; | ||
|
||
export default InfoCard; |
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