Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging #73

Merged
merged 14 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Contentstack
Copyright (c) 2023 Contentstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
30 changes: 14 additions & 16 deletions components/archive-relative.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,18 @@ type BlogListProps = {
}

export default function ArchiveRelative({ blogs }: BlogListProps) {
return (
<>
{blogs?.map((blog, idx) => (
<Link href={blog.url} key={idx}>
<a>
<div>
<h4 {...blog.$?.title as {}}>{blog.title}</h4>
{typeof blog.body === 'string' && (
<div {...blog.$?.body as {}}>{parse(blog.body.slice(0, 80))}</div>
)}
</div>
</a>
</Link>
))}
</>
);
return <>
{blogs?.map((blog, idx) => (
(<Link href={blog.url} key={idx}>

<div>
<h4 {...blog.$?.title as {}}>{blog.title}</h4>
{typeof blog.body === 'string' && (
<div {...blog.$?.body as {}}>{parse(blog.body.slice(0, 80))}</div>
)}
</div>

</Link>)
))}
</>;
}
40 changes: 20 additions & 20 deletions components/blog-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ function BlogList({ bloglist }: { bloglist: BloglistProps }) {
return (
<div className='blog-list'>
{bloglist.featured_image && (
<Link href={bloglist.url}>
<a>
<img
className='blog-list-img'
src={bloglist.featured_image.url}
alt='blog img'
{...bloglist.featured_image.$?.url as {}}
/>
</a>
</Link>
(<Link href={bloglist.url}>

<img
className='blog-list-img'
src={bloglist.featured_image.url}
alt='blog img'
{...bloglist.featured_image.$?.url as {}}
/>

</Link>)
)}
<div className='blog-content'>
{bloglist.title && (
<Link href={bloglist.url}>
<a>
<h3 {...bloglist.$?.title}>{bloglist.title}</h3>
</a>
</Link>
(<Link href={bloglist.url}>

<h3 {...bloglist.$?.title}>{bloglist.title}</h3>

</Link>)
)}
<p>
<strong {...bloglist.$?.date as {}}>
Expand All @@ -66,11 +66,11 @@ function BlogList({ bloglist }: { bloglist: BloglistProps }) {
</p>
<div {...bloglist.$?.body as {}}>{parse(body)}</div>
{bloglist.url ? (
<Link href={bloglist.url}>
<a>
<span>{'Read more -->'}</span>
</a>
</Link>
(<Link href={bloglist.url}>

<span>{'Read more -->'}</span>

</Link>)
) : (
''
)}
Expand Down
20 changes: 10 additions & 10 deletions components/blog-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export default function BlogSection(props: FeaturedBlogProps) {
<h2 {...fromBlog.$?.title_h2 as {}}>{fromBlog.title_h2}</h2>
)}
{fromBlog.view_articles && (
<Link href={fromBlog.view_articles.href}>
<a
className='btn secondary-btn article-btn'
{...fromBlog.view_articles.$?.title}
>
{fromBlog.view_articles.title}
</a>
</Link>
(<Link
href={fromBlog.view_articles.href}
className='btn secondary-btn article-btn'
{...fromBlog.view_articles.$?.title}>

{fromBlog.view_articles.title}

</Link>)
)}
</div>
<div className='home-featured-blogs'>
Expand All @@ -75,8 +75,8 @@ export default function BlogSection(props: FeaturedBlogProps) {
<div>{parse(blog.body.slice(0, 300))}</div>
)}
{blog.url && (
<Link href={blog.url} passHref>
<a className='blogpost-readmore'>{'Read More -->'}</a>
<Link href={blog.url} passHref className='blogpost-readmore'>
{'Read More -->'}
</Link>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions components/card-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default function CardSection({ cards }: CardProps) {
{card.description && <p {...card.$?.description as {}}>{card.description}</p>}
<div className='card-cta'>
{card.call_to_action.title && card.call_to_action.href && (
<Link href={card.call_to_action.href}>
<a className='btn primary-btn'>{card.call_to_action.title}</a>
<Link href={card.call_to_action.href} className='btn primary-btn'>
{card.call_to_action.title}
</Link>
)}
</div>
Expand Down
10 changes: 5 additions & 5 deletions components/devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import dynamic from 'next/dynamic';
import Tooltip from './tool-tip';

const DynamicReactJson = dynamic(import('react-json-view'), { ssr: false });
const DynamicJsonViewer = dynamic(() => import('@textea/json-viewer').then((module) => ({ default: module.JsonViewer })), { ssr: false });

function filterObject(inputObject: any) {
const unWantedProps = [
Expand Down Expand Up @@ -87,10 +87,10 @@ const DevTools = ({ response }: any) => {
{response ? (
<pre id="jsonViewer">
{response && (
<DynamicReactJson
src={filteredJson}
collapsed={1}
name="response"
<DynamicJsonViewer
value={filteredJson}
defaultInspectDepth={1}
rootName="response"
displayDataTypes={false}
enableClipboard={false}
style={{ color: '#C8501E' }}
Expand Down
24 changes: 12 additions & 12 deletions components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ export default function Footer({ footer, entries }: {footer: FooterProps, entrie
<div className='max-width footer-div'>
<div className='col-quarter'>
{footerData && footerData.logo ? (
<Link href='/'>
<a className='logo-tag'>
<img
src={footerData.logo.url}
alt={footerData.title}
title={footerData.title}
{...footer.logo.$?.url as {}}
className='logo footer-logo'
/>
</a>
</Link>
(<Link href='/' className='logo-tag'>

<img
src={footerData.logo.url}
alt={footerData.title}
title={footerData.title}
{...footer.logo.$?.url as {}}
className='logo footer-logo'
/>

</Link>)
) : (
<Skeleton width={150} />
)}
Expand All @@ -77,7 +77,7 @@ export default function Footer({ footer, entries }: {footer: FooterProps, entrie
key={menu.title}
{...menu.$?.title}
>
<Link href={menu.href}>{menu.title}</Link>
<Link href={menu.href} legacyBehavior>{menu.title}</Link>
</li>
))
) : (
Expand Down
26 changes: 13 additions & 13 deletions components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ export default function Header({ header, entries }: {header: HeaderProps, entrie
<div className='max-width header-div'>
<div className='wrapper-logo'>
{headerData ? (
<Link href='/'>
<a className='logo-tag' title='Contentstack'>
<img
className='logo'
src={headerData.logo.url}
alt={headerData.title}
title={headerData.title}
{...headerData.logo.$?.url as {}}
/>
</a>
</Link>
(<Link href='/' className='logo-tag' title='Contentstack'>

<img
className='logo'
src={headerData.logo.url}
alt={headerData.title}
title={headerData.title}
{...headerData.logo.$?.url as {}}
/>

</Link>)
) : (
<Skeleton width={150} />
)}
Expand All @@ -100,8 +100,8 @@ export default function Header({ header, entries }: {header: HeaderProps, entrie
className='nav-li'
{...list.page_reference[0].$?.url as {}}
>
<Link href={list.page_reference[0].url}>
<a className={className}>{list.label}</a>
<Link href={list.page_reference[0].url} className={className}>
{list.label}
</Link>
</li>
);
Expand Down
13 changes: 8 additions & 5 deletions components/hero-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ export default function HeroBanner(props: BannerProps) {
''
)}
{banner.call_to_action.title && banner.call_to_action.href ? (
<Link href={banner?.call_to_action.href}>
<a className='btn tertiary-btn' {...banner.call_to_action.$?.title}>
{banner?.call_to_action.title}
</a>
</Link>
(<Link
href={banner?.call_to_action.href}
className='btn tertiary-btn'
{...banner.call_to_action.$?.title}>

{banner?.call_to_action.title}

</Link>)
) : (
''
)}
Expand Down
2 changes: 1 addition & 1 deletion components/section-bucket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function SectionBucket({ section }: {section: BucketProps}) {
href={
bucket.call_to_action.href ? bucket.call_to_action.href : '#'
}
>
legacyBehavior>
{`${bucket.call_to_action.title} -->`}
</Link>
) : (
Expand Down
16 changes: 8 additions & 8 deletions components/section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export default function Section({ section }: {section : SectionProps}) {
<p {...section.$?.description as {}}>{section.description}</p>
)}
{section.call_to_action.title && section.call_to_action.href ? (
<Link href={section.call_to_action.href}>
<a
className='btn secondary-btn'
{...section.call_to_action.$?.title}
>
{section.call_to_action.title}
</a>
</Link>
(<Link
href={section.call_to_action.href}
className='btn secondary-btn'
{...section.call_to_action.$?.title}>

{section.call_to_action.title}

</Link>)
) : (
''
)}
Expand Down
1 change: 1 addition & 0 deletions contentstack-sdk/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const Stack = contentstack.Stack({
? envConfig.CONTENTSTACK_API_KEY
: envConfig.NEXT_PUBLIC_CONTENTSTACK_API_KEY,
delivery_token: envConfig.CONTENTSTACK_DELIVERY_TOKEN,
branch: envConfig.CONTENTSTACK_BRANCH ? envConfig.CONTENTSTACK_BRANCH : 'main',
environment: envConfig.CONTENTSTACK_ENVIRONMENT,
region: envConfig.CONTENTSTACK_REGION ? envConfig.CONTENTSTACK_REGION : 'us',
live_preview: {
Expand Down
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const config = {
// Will be available on both server and client
CONTENTSTACK_API_KEY: process.env.CONTENTSTACK_API_KEY,
CONTENTSTACK_DELIVERY_TOKEN: process.env.CONTENTSTACK_DELIVERY_TOKEN,
CONTENTSTACK_BRANCH: process.env.CONTENTSTACK_BRANCH || 'main',
CONTENTSTACK_ENVIRONMENT: process.env.CONTENTSTACK_ENVIRONMENT,
CONTENTSTACK_MANAGEMENT_TOKEN: process.env.CONTENTSTACK_MANAGEMENT_TOKEN,
CONTENTSTACK_API_HOST:
Expand Down
Loading