Skip to content

Commit 1020da6

Browse files
committed
hotfix/prototype changes
1 parent a43e9f0 commit 1020da6

File tree

18 files changed

+569
-990
lines changed

18 files changed

+569
-990
lines changed

app/blog/[post]/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export default function BlogPost() {
3535
onEntryChange(() => fetchData());
3636
}, []);
3737

38-
const { post, banner } = getPost;
38+
const { post, banner } = getPost;
39+
3940
return (
4041
<>
4142
{blogPost?.seo && blogPost.seo.enable_search_indexing && metaData(blogPost.seo)}

app/layout.tsx

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import type { Metadata, Viewport } from "next";
22
import { Inter } from "next/font/google";
3+
import Script from "next/script";
34
import Header from "@/components/header";
5+
import Footer from "@/components/footer";
46

57
import 'react-loading-skeleton/dist/skeleton.css';
6-
import Footer from "@/components/footer";
78

89
const inter = Inter({ subsets: ["latin"] });
910

@@ -19,24 +20,17 @@ export const viewport: Viewport = {
1920
width: 'device-width',
2021
};
2122

22-
export default async function RootLayout({
23+
export default function RootLayout({
2324
children,
2425
}: Readonly<{
2526
children: React.ReactNode;
2627
}>) {
27-
2828
return (
2929
<html lang="en">
3030
<head>
31-
<script
32-
src='https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js'
33-
integrity='sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM'
34-
crossOrigin='anonymous'
35-
defer
36-
/>
3731
<link rel='preconnect' href='https://fonts.gstatic.com' />
3832
<link
39-
href='https://fonts.googleapis.com/css?family=Inter&amp;display=swap'
33+
href='https://fonts.googleapis.com/css?family=Inter&display=swap'
4034
rel='stylesheet'
4135
/>
4236
<link
@@ -52,30 +46,22 @@ export default async function RootLayout({
5246
integrity='sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC'
5347
crossOrigin='anonymous'
5448
/>
55-
<link
56-
rel='stylesheet'
57-
href="/styles/globals.css"
58-
/>
59-
<link
60-
rel='stylesheet'
61-
href="/styles/style.css"
62-
/>
63-
<link
64-
rel='stylesheet'
65-
href="/styles/third-party.css"
66-
/>
67-
49+
<link rel='stylesheet' href="/styles/globals.css" />
50+
<link rel='stylesheet' href="/styles/style.css" />
51+
<link rel='stylesheet' href="/styles/third-party.css" />
6852
</head>
69-
<body>
70-
<>
71-
<Header />
72-
<main className='mainClass mt-5'>
73-
<>
74-
{children}
75-
</>
76-
</main>
77-
</>
53+
<body className={inter.className}>
54+
<Header />
55+
<main className='mainClass mt-5'>
56+
{children}
57+
</main>
7858
<Footer />
59+
<Script
60+
src='https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js'
61+
integrity='sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM'
62+
crossOrigin='anonymous'
63+
strategy="lazyOnload"
64+
/>
7965
</body>
8066
</html>
8167
);

app/page.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import Skeleton from "react-loading-skeleton";
1010

1111
export default function Home() {
1212
const entryUrl = usePathname();
13-
14-
const [getEntry, setEntry] = useState<Page>();
13+
const [getEntry, setEntry] = useState<Page | undefined>(undefined);
1514

1615
async function fetchData() {
1716
try {
@@ -27,8 +26,7 @@ export default function Home() {
2726
onEntryChange(() => fetchData());
2827
}, []);
2928

30-
31-
return getEntry ? (
29+
return getEntry?.page_components ? (
3230
<>
3331
{getEntry.seo && getEntry.seo.enable_search_indexing && metaData(getEntry.seo)}
3432
<RenderComponents

components/archive-relative.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ export default function ArchiveRelative({ blogs }: BlogListProps) {
2222
return (
2323
<>
2424
{blogs?.map((blog, idx) => (
25-
<Link legacyBehavior href={blog.url} key={idx}>
26-
<a>
27-
<div>
28-
<h4 {...blog.$?.title as {}}>{blog.title}</h4>
29-
{typeof blog.body === 'string' && (
30-
<div {...blog.$?.body as {}}>{parse(blog.body.slice(0, 80))}</div>
31-
)}
32-
</div>
33-
</a>
25+
<Link href={blog.url} key={idx}>
26+
<div>
27+
<h4 {...blog.$?.title as {}}>{blog.title}</h4>
28+
{typeof blog.body === 'string' && (
29+
<div {...blog.$?.body as {}}>{parse(blog.body.slice(0, 80))}</div>
30+
)}
31+
</div>
3432
</Link>
3533
))}
3634
</>

components/blog-list.tsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,19 @@ function BlogList({ bloglist }: { bloglist: BloglistProps }) {
3737
return (
3838
<div className='blog-list'>
3939
{bloglist.featured_image && (
40-
<Link legacyBehavior href={bloglist.url}>
41-
<a>
42-
<img
43-
className='blog-list-img'
44-
src={bloglist.featured_image.url}
45-
alt='blog img'
46-
{...bloglist.featured_image.$?.url as {}}
47-
/>
48-
</a>
40+
<Link href={bloglist.url}>
41+
<img
42+
className='blog-list-img'
43+
src={bloglist.featured_image.url}
44+
alt='blog img'
45+
{...bloglist.featured_image.$?.url as {}}
46+
/>
4947
</Link>
5048
)}
5149
<div className='blog-content'>
5250
{bloglist.title && (
53-
<Link legacyBehavior href={bloglist.url}>
54-
<a>
55-
<h3 {...bloglist.$?.title}>{bloglist.title}</h3>
56-
</a>
51+
<Link href={bloglist.url}>
52+
<h3 {...bloglist.$?.title}>{bloglist.title}</h3>
5753
</Link>
5854
)}
5955
<p>
@@ -67,10 +63,8 @@ function BlogList({ bloglist }: { bloglist: BloglistProps }) {
6763
</p>
6864
<div {...bloglist.$?.body as {}}>{parse(body)}</div>
6965
{bloglist.url ? (
70-
<Link legacyBehavior href={bloglist.url}>
71-
<a>
72-
<span>{'Read more -->'}</span>
73-
</a>
66+
<Link href={bloglist.url}>
67+
<span>{'Read more -->'}</span>
7468
</Link>
7569
) : (
7670
''

components/blog-section.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,12 @@ export default function BlogSection(props: FeaturedBlogProps) {
4848
<h2 {...fromBlog.$?.title_h2 as {}}>{fromBlog.title_h2}</h2>
4949
)}
5050
{fromBlog.view_articles && (
51-
<Link legacyBehavior href={fromBlog.view_articles.href}>
52-
<a
53-
className='btn secondary-btn article-btn'
54-
{...fromBlog.view_articles.$?.title}
55-
>
56-
{fromBlog.view_articles.title}
57-
</a>
51+
<Link
52+
href={fromBlog.view_articles.href}
53+
className='btn secondary-btn article-btn'
54+
{...fromBlog.view_articles.$?.title}
55+
>
56+
{fromBlog.view_articles.title}
5857
</Link>
5958
)}
6059
</div>
@@ -75,8 +74,8 @@ export default function BlogSection(props: FeaturedBlogProps) {
7574
<div>{parse(blog.body.slice(0, 300))}</div>
7675
)}
7776
{blog.url && (
78-
<Link legacyBehavior href={blog.url} passHref>
79-
<a className='blogpost-readmore'>{'Read More -->'}</a>
77+
<Link href={blog.url} className='blogpost-readmore'>
78+
{'Read More -->'}
8079
</Link>
8180
)}
8281
</div>

components/card-section.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export default function CardSection({ cards }: CardProps) {
2727
{card.description && <p {...card.$?.description as {}}>{card.description}</p>}
2828
<div className='card-cta'>
2929
{card.call_to_action.title && card.call_to_action.href && (
30-
<Link legacyBehavior href={card.call_to_action.href}>
31-
<a className='btn primary-btn'>{card.call_to_action.title}</a>
30+
<Link href={card.call_to_action.href} className='btn primary-btn'>
31+
{card.call_to_action.title}
3232
</Link>
3333
)}
3434
</div>

components/footer.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,14 @@ export default function Footer() {
6868
<div className='max-width footer-div'>
6969
<div className='col-quarter'>
7070
{footerData && footerData.logo ? (
71-
<Link legacyBehavior href='/'>
72-
<a className='logo-tag'>
73-
<img
74-
src={footerData.logo.url}
75-
alt={footerData.title}
76-
title={footerData.title}
77-
{...(footer?.logo?.$?.url as {})}
78-
className='logo footer-logo'
79-
/>
80-
</a>
71+
<Link href='/' className='logo-tag'>
72+
<img
73+
src={footerData.logo.url}
74+
alt={footerData.title}
75+
title={footerData.title}
76+
{...(footer?.logo?.$?.url as {})}
77+
className='logo footer-logo'
78+
/>
8179
</Link>
8280
) : (
8381
<Skeleton width={150} />

components/header.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,14 @@ export default function Header() {
8383
<div className='max-width header-div'>
8484
<div className='wrapper-logo'>
8585
{headerData ? (
86-
<Link legacyBehavior href='/'>
87-
<a className='logo-tag' title='Contentstack'>
88-
<img
89-
className='logo'
90-
src={headerData.logo.url}
91-
alt={headerData.title}
92-
title={headerData.title}
93-
{...headerData.logo.$?.url as {}}
94-
/>
95-
</a>
86+
<Link href='/' className='logo-tag' title='Contentstack'>
87+
<img
88+
className='logo'
89+
src={headerData.logo.url}
90+
alt={headerData.title}
91+
title={headerData.title}
92+
{...headerData.logo.$?.url as {}}
93+
/>
9694
</Link>
9795
) : (
9896
<Skeleton width={150} />
@@ -114,8 +112,8 @@ export default function Header() {
114112
className='nav-li'
115113
{...list.page_reference[0].$?.url as {}}
116114
>
117-
<Link legacyBehavior href={list.page_reference[0].url}>
118-
<a className={className}>{list.label}</a>
115+
<Link href={list.page_reference[0].url} className={className}>
116+
{list.label}
119117
</Link>
120118
</li>
121119
);

components/hero-banner.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ export default function HeroBanner(props: BannerProps) {
5757
''
5858
)}
5959
{banner.call_to_action.title && banner.call_to_action.href ? (
60-
<Link legacyBehavior href={banner?.call_to_action.href}>
61-
<a className='btn tertiary-btn' {...banner.call_to_action.$?.title}>
62-
{banner?.call_to_action.title}
63-
</a>
60+
<Link href={banner?.call_to_action.href} className='btn tertiary-btn' {...banner.call_to_action.$?.title}>
61+
{banner?.call_to_action.title}
6462
</Link>
6563
) : (
6664
''

0 commit comments

Comments
 (0)