From 6219c43bb788093a144577a20207fe7a06c4ddba Mon Sep 17 00:00:00 2001 From: Amitkanswal Date: Wed, 13 Oct 2021 11:12:02 +0530 Subject: [PATCH 1/8] feat:added json viewer [ECO-188] --- env.sample => .env.sample | 0 .eslintrc.js | 10 +- components/about-section-bucket.js | 5 +- components/archive-relative.js | 5 +- components/blog-banner.js | 1 - components/blog-section.js | 9 +- components/card-section.js | 1 - components/devtools.js | 49 + components/footer.js | 9 +- components/header.js | 25 +- components/hero-banner.js | 6 +- components/layout.js | 41 +- components/render-components.js | 2 - components/section-bucket.js | 4 +- components/section-with-html-code.js | 11 +- components/section.js | 1 - package-lock.json | 20206 +++---------------------- package.json | 36 +- pages/about-us.jsx | 2 +- pages/blog/[...post].jsx | 6 +- pages/blog/index.jsx | 6 +- pages/contact-us.jsx | 2 +- pages/index.jsx | 2 +- styles/style.css | 17 +- 24 files changed, 2496 insertions(+), 17960 deletions(-) rename env.sample => .env.sample (100%) create mode 100644 components/devtools.js diff --git a/env.sample b/.env.sample similarity index 100% rename from env.sample rename to .env.sample diff --git a/.eslintrc.js b/.eslintrc.js index aa729de..6abe559 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -20,13 +20,19 @@ module.exports = { }, rules: { 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], - "react/prefer-stateless-function":[0, { "ignorePureComponents": true }], + "react/prefer-stateless-function": [0, { ignorePureComponents: true }], "react/prop-types": [0], 'func-names': ['error', 'never'], quotes: 'off', 'prettier/prettier': 'off', 'prop-types': 'off', 'react/destructuring-assignment': 'off', - 'eslint-disable-next-line jsx-a11y/anchor-is-valid':'off', + 'eslint-disable-next-line jsx-a11y/anchor-is-valid': 'off', + 'no-restricted-syntax': 'off', + 'react/no-array-index-key': 'off', + 'consistent-return': 'off', + 'global-require': 'off', + 'jsx-a11y/anchor-is-valid': 'off', + 'jsx-a11y/label-has-associated-control': 'off', }, }; diff --git a/components/about-section-bucket.js b/components/about-section-bucket.js index 3b9f82e..8744fb2 100644 --- a/components/about-section-bucket.js +++ b/components/about-section-bucket.js @@ -1,6 +1,5 @@ -/* eslint-disable no-undef */ import React from "react"; -import ReactHtmlParser from "react-html-parser"; +import parse from "html-react-parser"; export default function AboutSectionBucket(props) { const { sectionWithBuckets } = props; @@ -13,7 +12,7 @@ export default function AboutSectionBucket(props) {
{bucket.title_h3 &&

{bucket.title_h3}

} - {bucket.description && ReactHtmlParser(bucket.description)} + {bucket.description && parse(bucket.description)}
); diff --git a/components/archive-relative.js b/components/archive-relative.js index 352409f..979fd72 100644 --- a/components/archive-relative.js +++ b/components/archive-relative.js @@ -1,7 +1,6 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ import React from "react"; import Link from "next/link"; -import ReactHtmlParser from "react-html-parser"; +import parse from "html-react-parser"; export default function ArchiveRelative(props) { const { blogs } = props; @@ -12,7 +11,7 @@ export default function ArchiveRelative(props) {

{blog.title}

- {ReactHtmlParser(blog.body.slice(0, 80))} + {parse(blog.body.slice(0, 80))}
diff --git a/components/blog-banner.js b/components/blog-banner.js index 121a9d6..0c3003a 100644 --- a/components/blog-banner.js +++ b/components/blog-banner.js @@ -1,4 +1,3 @@ -/* eslint-disable camelcase */ import React from "react"; export default function BlogBanner(props) { diff --git a/components/blog-section.js b/components/blog-section.js index 28c3010..d6ac4a0 100644 --- a/components/blog-section.js +++ b/components/blog-section.js @@ -1,11 +1,6 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ -/* eslint-disable react/prop-types */ -/* eslint-disable react/prefer-stateless-function */ -/* eslint-disable no-undef */ -/* eslint-disable react/no-array-index-key */ import React from "react"; import Link from "next/link"; -import ReactHtmlParser from "react-html-parser"; +import parse from "html-react-parser"; class BlogSection extends React.Component { render() { @@ -34,7 +29,7 @@ class BlogSection extends React.Component { )}
{blog.title &&

{blog.title}

} - {blog.body && ReactHtmlParser(blog.body.slice(0, 300))} + {blog.body && parse(blog.body.slice(0, 300))} {blog.url && ( {"Read More -->"} diff --git a/components/card-section.js b/components/card-section.js index 106518d..da10958 100644 --- a/components/card-section.js +++ b/components/card-section.js @@ -1,4 +1,3 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ import React from "react"; import Link from "next/link"; diff --git a/components/devtools.js b/components/devtools.js new file mode 100644 index 0000000..089b4d5 --- /dev/null +++ b/components/devtools.js @@ -0,0 +1,49 @@ +import React from 'react'; +import dynamic from "next/dynamic"; + +const DynamicReactJson = dynamic(import('react-json-view'), { ssr: false }); + +const DevTools = ({ response }) => ( + +); +export default DevTools; diff --git a/components/footer.js b/components/footer.js index 5df7e6c..fe6bef9 100644 --- a/components/footer.js +++ b/components/footer.js @@ -1,7 +1,6 @@ -/* eslint-disable jsx-a11y/alt-text */ import React from "react"; import Link from "next/link"; -import ReactHtmlParser from "react-html-parser"; +import parse from "html-react-parser"; export default function Footer(props) { const { footer } = props; @@ -21,7 +20,7 @@ export default function Footer(props) {
- {footer.social.social_share?.map(social => ( + {footer.social.social_share?.map((social) => (
- {footer.copyright && ReactHtmlParser(footer.copyright)} + {footer.copyright && parse(footer.copyright)}
); diff --git a/components/header.js b/components/header.js index d483da1..5cb9659 100644 --- a/components/header.js +++ b/components/header.js @@ -1,23 +1,24 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ -/* eslint-disable jsx-a11y/label-has-associated-control */ -/* eslint-disable jsx-a11y/label-has-for */ import React from "react"; import Link from "next/link"; import { useRouter } from "next/router"; -import ReactHtmlParser from "react-html-parser"; +import parse from "html-react-parser"; export default function Header(props) { const { header } = props; const router = useRouter(); return (
- {header.notification_bar.show_announcement ? ( -
- {ReactHtmlParser(header.notification_bar.announcement_text)} -
- ) : ( - "" - )} +
+ {header.notification_bar.show_announcement + && parse(header.notification_bar.announcement_text)} + + + +
@@ -35,7 +36,7 @@ export default function Header(props) {