Skip to content

Commit 4da0b3f

Browse files
Merge pull request #33 from contentstack/refactor/ECO-960_add_typescript
refactor: add typescript [ECO-960]
2 parents c9b7910 + 7f17118 commit 4da0b3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2442
-1336
lines changed

.eslintrc.json

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
{
2-
"extends": ["next/babel","next/core-web-vitals"],
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:react/recommended",
9+
"extends: next/core-web-vitals"
10+
],
11+
"parserOptions": {
12+
"ecmaFeatures": {
13+
"jsx": true
14+
},
15+
"ecmaVersion": 12,
16+
"sourceType": "module"
17+
},
18+
"plugins": [
19+
"react"
20+
],
321
"rules": {
4-
"@next/next/no-page-custom-font":"off",
5-
"@next/next/no-sync-scripts":"off",
6-
"@next/next/no-img-element":"off",
7-
"react-hooks/exhaustive-deps":"off",
8-
"import/no-anonymous-default-export":"off"
22+
"react/prop-types":0,
23+
"no-undef":"off",
24+
"no-unused-vars": "off"
925
}
1026
}

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
npm-debug.log*
2424
yarn-debug.log*
2525
yarn-error.log*
26+
.pnpm-debug.log*
2627

2728
# local env files
28-
.env
29-
.env.local
30-
.env.development.local
31-
.env.test.local
32-
.env.production.local
29+
.env*.local
3330

3431
# vercel
3532
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,3 @@ Read Contentstack [docs](https://www.contentstack.com/docs/)
3030
Region support [docs](https://www.contentstack.com/docs/developers/selecting-region-in-contentstack-starter-apps)
3131

3232
Learn about [Next.js](https://learnnextjs.com/)
33-
34-
35-
36-
37-
38-
39-
40-
41-

SECURITY.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Security
2+
3+
Contentstack takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations.
4+
5+
If you believe you have found a security vulnerability in any Contentstack-owned repository, please report it to us as described below.
6+
7+
## Reporting Security Issues
8+
9+
**Please do not report security vulnerabilities through public GitHub issues.**
10+
11+
Send email to [security@contentstack.com](mailto:security@contentstack.com).
12+
13+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
14+
15+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
16+
17+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
18+
* Full paths of source file(s) related to the manifestation of the issue
19+
* The location of the affected source code (tag/branch/commit or direct URL)
20+
* Any special configuration required to reproduce the issue
21+
* Step-by-step instructions to reproduce the issue
22+
* Proof-of-concept or exploit code (if possible)
23+
* Impact of the issue, including how an attacker might exploit the issue
24+
25+
This information will help us triage your report more quickly.
26+
27+
[https://www.contentstack.com/trust/](https://www.contentstack.com/trust/)
Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
import React from 'react';
22
import parse from 'html-react-parser';
3+
import { Action,Image } from '../typescript/action';
34

4-
export default function AboutSectionBucket({ sectionWithBuckets }) {
5-
function bucketContent(bucket, index) {
5+
type AdditionalParam = {
6+
title_h2?: string;
7+
title_h3?: string;
8+
description?: string;
9+
}
10+
11+
type Bucket = {
12+
title_h3: string;
13+
description: string;
14+
icon: Image;
15+
$: AdditionalParam;
16+
url: string;
17+
}
18+
19+
type BucketsList = {
20+
title_h3: string;
21+
description: string;
22+
url: string;
23+
call_to_action: Action;
24+
icon: Image;
25+
$: AdditionalParam;
26+
}
27+
28+
type BucketProps = {
29+
title_h2: string;
30+
buckets:[BucketsList];
31+
$: AdditionalParam;
32+
}
33+
34+
export default function AboutSectionBucket({ sectionWithBuckets }: {sectionWithBuckets:BucketProps}) {
35+
function bucketContent(bucket: Bucket, index: number) {
636
return (
737
<div className='mission-content-section' key={index}>
838
{bucket.icon && (
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,23 @@ import React from 'react';
22
import Link from 'next/link';
33
import parse from 'html-react-parser';
44

5-
export default function ArchiveRelative({ blogs }) {
5+
type AdditionalParam = {
6+
title: string;
7+
body: string;
8+
}
9+
10+
type Blog = {
11+
url: string;
12+
body: string;
13+
title: string;
14+
$: AdditionalParam;
15+
}
16+
17+
type BlogListProps = {
18+
blogs: [Blog];
19+
}
20+
21+
export default function ArchiveRelative({ blogs }: BlogListProps) {
622
return (
723
<>
824
{blogs?.map((blog, idx) => (
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
import React from 'react';
22

3-
export default function BlogBanner({ blogBanner }) {
3+
type AdditionalParam = {
4+
banner_title:string;
5+
banner_description: string;
6+
title: {};
7+
title_h2: string;
8+
body: string;
9+
date: string;
10+
}
11+
12+
type BannerProps = {
13+
banner_title:string;
14+
banner_description: string;
15+
bg_color: string;
16+
$: AdditionalParam;
17+
}
18+
19+
export default function BlogBanner({ blogBanner }: {blogBanner : BannerProps}) {
420
return (
521
<div
622
className='blog-page-banner'
Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,35 @@ import React from 'react';
22
import moment from 'moment';
33
import parse from 'html-react-parser';
44
import Link from 'next/link';
5+
import { Image } from "../typescript/action";
56

6-
function BlogList({ bloglist }) {
7-
let body = typeof bloglist.body === 'string' && bloglist.body.substr(0, 300);
7+
type AdditionalParam = {
8+
banner_title:string;
9+
banner_description: string;
10+
title: {};
11+
title_h2: string;
12+
body: string;
13+
date: string;
14+
}
15+
16+
type Author = {
17+
title: string;
18+
$: AdditionalParam;
19+
}
20+
21+
22+
type BloglistProps = {
23+
body: string;
24+
url: string;
25+
featured_image: Image;
26+
title: string;
27+
date: string;
28+
author: [Author];
29+
$: AdditionalParam;
30+
}
31+
32+
function BlogList({ bloglist }: { bloglist: BloglistProps }) {
33+
let body: string = bloglist.body && bloglist.body.substr(0, 300);
834
const stringLength = body.lastIndexOf(' ');
935
body = `${body.substr(0, Math.min(body.length, stringLength))}...`;
1036
return (
Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,46 @@
11
import React from 'react';
22
import Link from 'next/link';
33
import parse from 'html-react-parser';
4+
import { Image } from "../typescript/action";
5+
6+
type AdditionalParam = {
7+
banner_title:string;
8+
banner_description: string;
9+
title: {};
10+
title_h2: string;
11+
body: string;
12+
date: string;
13+
}
14+
15+
type Article = {
16+
href: string;
17+
title: string;
18+
$: AdditionalParam;
19+
}
20+
21+
type FeaturedBlog = {
22+
title: string;
23+
featured_image: Image;
24+
body: string;
25+
url: string;
26+
$: AdditionalParam;
27+
}
28+
29+
type FeaturedBlogData = {
30+
title_h2: string;
31+
view_articles: Article;
32+
featured_blogs: [FeaturedBlog]
33+
$: AdditionalParam;
34+
}
35+
36+
type FeaturedBlogProps = {
37+
fromBlog: FeaturedBlogData;
38+
}
39+
40+
export default function BlogSection(props: FeaturedBlogProps) {
41+
42+
const fromBlog = props.fromBlog;
443

5-
export default function BlogSection({ fromBlog }) {
644
return (
745
<div className='community-section'>
846
<div className='community-head'>
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
import React from 'react';
22
import Link from 'next/link';
3+
import { Action } from "../typescript/action";
34

4-
export default function CardSection({ cards }) {
5+
type AdditionalParam = {
6+
title_h3: string;
7+
description: string;
8+
}
9+
10+
type Card = {
11+
title_h3: string;
12+
description: string;
13+
call_to_action: Action;
14+
$: AdditionalParam;
15+
}
16+
17+
type CardProps = {
18+
cards: [Card]
19+
}
20+
21+
export default function CardSection({ cards }: CardProps) {
522
return (
623
<div className='demo-section'>
724
{cards?.map((card, index) => (

0 commit comments

Comments
 (0)