Skip to content

Commit 4baea87

Browse files
committed
update image next 13
1 parent 6f9cade commit 4baea87

24 files changed

Lines changed: 286 additions & 229 deletions

‎apps/codingcatdev/next.config.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ module.exports = withPWA(
1515
withBundleAnalyzer({
1616
reactStrictMode: true,
1717
images: {
18-
domains: ['s3.us-west-2.amazonaws.com'],
19-
loader: 'cloudinary',
20-
path: 'https://media.codingcat.dev/image/upload/',
18+
domains: ['s3.us-west-2.amazonaws.com', 'media.codingcat.dev'],
2119
},
2220
async redirects() {
2321
return [

‎apps/codingcatdev/src/components/ActiveLink.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Link from 'next/link';
33
import React, { Children } from 'react';
44

55
function ActiveLink({ router, children, ...props }: any) {
6-
const child = Children.only(children);
6+
const child = Children.only(<>{children}</>);
77
let className = child.props.className || '';
88
if (
99
router.asPath.includes(props.comparison || props.href) &&
@@ -16,7 +16,7 @@ function ActiveLink({ router, children, ...props }: any) {
1616

1717
return (
1818
<Link href={props.href} {...props}>
19-
{React.cloneElement(child, { className })}
19+
<>{React.cloneElement(child, { className })}</>
2020
</Link>
2121
);
2222
}

‎apps/codingcatdev/src/components/PostMedia.tsx‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { config } from '@/config/cloudinary';
44

55
import { Video } from 'cloudinary-react';
66
import ReactPlayer from 'react-player/lazy';
7-
import Image from "next/legacy/image";
7+
import Image from 'next/image';
88
import { SetStateAction } from 'react';
99

1010
export default function PostMedia({
@@ -113,14 +113,18 @@ export default function PostMedia({
113113
</div>
114114
) : (
115115
<>
116-
{!noImage && post.coverPhoto?.public_id ? (
116+
{!noImage && post.coverPhoto?.secure_url ? (
117117
<Image
118-
src={post.coverPhoto?.public_id}
118+
src={post.coverPhoto?.secure_url}
119119
alt={post.title}
120120
width="480"
121121
height="270"
122-
layout="responsive"
123122
priority
123+
sizes="100vw"
124+
style={{
125+
width: '100%',
126+
height: 'auto',
127+
}}
124128
/>
125129
) : !noImage &&
126130
(post?.cover?.external?.url || post?.cover?.file?.url) ? (
@@ -130,8 +134,12 @@ export default function PostMedia({
130134
alt={post.title}
131135
width="480"
132136
height="270"
133-
layout="responsive"
134137
priority
138+
sizes="100vw"
139+
style={{
140+
width: '100%',
141+
height: 'auto',
142+
}}
135143
/>
136144
) : (
137145
<></>

‎apps/codingcatdev/src/components/PostsCards.tsx‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Link from 'next/link';
2-
import Image from "next/legacy/image";
2+
import Image from 'next/image';
33
import { Post } from '@/models/post.model';
44
import AJPrimary from '@/components/global/icons/AJPrimary';
55

@@ -18,26 +18,34 @@ export default function PostsCards({ posts }: { posts: Post[] }): JSX.Element {
1818
href={`/${post._type}/${post.slug}`}
1919
className="self-start"
2020
>
21-
{post.coverPhoto?.public_id && post._type === 'course' ? (
21+
{post.coverPhoto?.secure_url && post._type === 'course' ? (
2222
<>
2323
<Image
24-
src={post.coverPhoto?.public_id}
24+
src={post.coverPhoto?.secure_url}
2525
alt={post.title}
2626
width="480"
2727
height="270"
28-
layout="responsive"
2928
className="rounded-md rounded-b-none cursor-pointer"
29+
sizes="100vw"
30+
style={{
31+
width: '100%',
32+
height: 'auto',
33+
}}
3034
/>
3135
</>
32-
) : post.coverPhoto?.public_id ? (
36+
) : post.coverPhoto?.secure_url ? (
3337
<>
3438
<Image
35-
src={post.coverPhoto?.public_id}
39+
src={post.coverPhoto?.secure_url}
3640
alt={post.title}
3741
width="480"
3842
height="270"
39-
layout="responsive"
4043
className="rounded-md rounded-b-none cursor-pointer"
44+
sizes="100vw"
45+
style={{
46+
width: '100%',
47+
height: 'auto',
48+
}}
4149
/>
4250
</>
4351
) : (

0 commit comments

Comments
 (0)