Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
use next-optimized-images@canary and its <Img />
- Loading branch information
Showing
11 changed files
with
1,195 additions
and
2,527 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,4 @@ | ||
{ | ||
"presets": ["next/babel"], | ||
"plugins": ["react-optimized-image/plugin"] | ||
} |
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 |
---|---|---|
@@ -1,23 +1,20 @@ | ||
import classnames from 'classnames'; | ||
|
||
import bgWebpSrc from '../assets/bg.jpg?webp'; | ||
import bgJpgSrc from '../assets/bg.jpg'; | ||
import Img from 'react-optimized-image'; | ||
|
||
import bgSrc from '../assets/bg.jpg'; | ||
|
||
const Background = ({ className }) => ( | ||
<picture> | ||
<source srcSet={bgWebpSrc} type='image/webp' /> | ||
<source srcSet={bgJpgSrc} type='image/jpeg' /> | ||
<img | ||
alt='background' | ||
src={bgJpgSrc} | ||
className={ | ||
classnames( | ||
'bg-background-avg print:hidden top-0 left-0 h-full w-full object-cover -z-1', | ||
className, | ||
) | ||
} | ||
/> | ||
</picture> | ||
<Img | ||
alt='background' | ||
src={bgSrc} webp | ||
className={ | ||
classnames( | ||
'bg-background-avg print:hidden top-0 left-0 h-full w-full object-cover -z-1', | ||
className, | ||
) | ||
} | ||
/> | ||
); | ||
|
||
export default Background; |
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
Oops, something went wrong.