Skip to content

Commit

Permalink
Remove old image opt
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlee85 committed Feb 23, 2024
1 parent d8b63a4 commit c49e25d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
4 changes: 2 additions & 2 deletions examples/v7-nextjs/components/ProductPreview.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Link from 'next/link'
import { Prefetch } from '@edgio/react'
import { relativizeURL } from '@/lib/helper'
import { HeartIcon } from '@heroicons/react/outline'
import { createNextDataURL } from '@edgio/next/client'
import Image from 'next/image'

const ProductPreview = ({ name, slug, images, prices }) => {
return (
Expand All @@ -24,7 +24,7 @@ const ProductPreview = ({ name, slug, images, prices }) => {
<h4 className="border border-gray-200 bg-white px-2 py-1 text-xs text-black md:px-4 md:py-2 md:text-lg">{`${prices.price.value}${prices.price.currencyCode}`}</h4>
</div>
<HeartIcon className="absolute right-0 top-0 h-[30px] w-[30px] bg-white p-2" />
<img className="h-full bg-white object-contain" loading="lazy" width={1200} height={1200} src={relativizeURL(images[0].url)} />
<Image className="h-full bg-white object-contain" loading="lazy" width={1200} height={1200} src={images[0].url} />
</Link>
</Prefetch>
)
Expand Down
3 changes: 3 additions & 0 deletions examples/v7-nextjs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const nextConfig = {
},
]
},
images: {
domains: ['edgio-community-ecommerce-api-example-default.layer0-limelight.link'],
},
}

module.exports = (phase, config) =>
Expand Down
8 changes: 4 additions & 4 deletions examples/v7-nextjs/pages/product/[name].js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StarIcon } from '@heroicons/react/solid'
import { relativizeURL, getOrigin } from '@/lib/helper'
import { HeartIcon, StarIcon as StarIconOutline } from '@heroicons/react/outline'

import { getOrigin } from '@/lib/helper'
import Image from 'next/image'
const Product = ({ data }) => {
return (
<div className="flex w-full flex-col items-center">
Expand All @@ -13,11 +13,11 @@ const Product = ({ data }) => {
</div>
<HeartIcon className="absolute right-0 top-0 z-10 h-[50px] w-[50px] border border-gray-200 bg-white p-2" />
<div className="flex w-full flex-col items-center">
<img src={relativizeURL(data.images[0].url)} className="h-auto w-full max-w-[600px]" />
<Image src={data.images[0].url} className="h-auto w-full max-w-[600px]" width={600} height={600} />
</div>
<div className="product-thumbnails mt-5 flex flex-row items-start gap-x-2 overflow-x-scroll">
{data.images.map((i, ind) => (
<img key={i.url} loading="lazy" src={relativizeURL(i.url)} className="h-[250px] w-auto hover:bg-white" />
<Image key={i.url} loading="lazy" src={i.url} className="h-[250px] w-auto hover:bg-white" width={250} height={250} />
))}
</div>
</div>
Expand Down
13 changes: 0 additions & 13 deletions examples/v7-nextjs/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,3 @@ export default new Router()
},
origin: { set_origin: 'api' },
})
.match('/edgio-opt', {
caching: { max_age: '86400s', stale_while_revalidate: '31536000s', bypass_client_cache: true },
url: {
url_rewrite: [
{
source: '/edgio-opt:optionalSlash(\\/?)?:optionalQuery(\\?.*)?',
syntax: 'path-to-regexp',
destination: '/:optionalSlash:optionalQuery',
},
],
},
origin: { set_origin: 'image' },
})

0 comments on commit c49e25d

Please sign in to comment.