|
1 | 1 | import DefaultErrorPage from 'next/error'; |
2 | 2 | import { NextRouter } from 'next/router'; |
3 | 3 | import Link from 'next/link'; |
| 4 | +import Image from 'next/image'; |
4 | 5 |
|
5 | 6 | import { useEffect, useState } from 'react'; |
6 | 7 | import { Post, PostType, SectionLesson } from '@/models/post.model'; |
@@ -58,7 +59,7 @@ export default function PostLayout({ |
58 | 59 | }, [user]); |
59 | 60 |
|
60 | 61 | function isActiveLink(course: Post, lesson: SectionLesson) { |
61 | | - if (router.asPath === `/courses/${course.slug}/lessons/${lesson.slug}`) |
| 62 | + if (router.asPath === `/course/${course.slug}/lesson/${lesson.slug}`) |
62 | 63 | return true; |
63 | 64 | return false; |
64 | 65 | } |
@@ -166,8 +167,12 @@ export default function PostLayout({ |
166 | 167 | > |
167 | 168 | <section className="flex items-center flex-shrink-0 space-x-4"> |
168 | 169 | {author.photoURL && ( |
169 | | - <img |
| 170 | + <Image |
170 | 171 | src={author.photoURL} |
| 172 | + loader={() => author.photoURL || ''} |
| 173 | + layout="fixed" |
| 174 | + height="50" |
| 175 | + width="50" |
171 | 176 | alt="instructor" |
172 | 177 | className="w-12 border-2 rounded-full border-primary-50 dark:border-primary-50" |
173 | 178 | /> |
@@ -243,17 +248,18 @@ export default function PostLayout({ |
243 | 248 | <Link |
244 | 249 | href={`/course/${course.slug}/lesson/${lesson.slug}`} |
245 | 250 | key={lesson.id} |
| 251 | + passHref |
246 | 252 | > |
247 | 253 | <div |
248 | | - className={`p-2 cursor-pointer |
| 254 | + className={`p-2 cursor-pointer hover:bg-primary-200 |
249 | 255 | ${ |
250 | 256 | isActiveLink(course, lesson) |
251 | 257 | ? 'bg-primary-200' |
252 | 258 | : 'bg-transparent' |
253 | 259 | } |
254 | 260 | `} |
255 | 261 | > |
256 | | - <a className="no-underline text-basics-900 hover:text-primary-900 hover:underline"> |
| 262 | + <a className="no-underline text-basics-900 hover:text-primary-900"> |
257 | 263 | {lesson.title} |
258 | 264 | </a> |
259 | 265 | </div> |
|
0 commit comments