From f173cf7d2d8d6c664d0cbfa6099c3c70730a8331 Mon Sep 17 00:00:00 2001
From: Ashmit JaiSarita Gupta
<43639341+devilkiller-ag@users.noreply.github.com>
Date: Mon, 11 Dec 2023 09:43:34 +0530
Subject: [PATCH] chore(website): create new playground layout (#1628)
---
modelina-website/package-lock.json | 66 ++
modelina-website/package.json | 2 +
modelina-website/src/components/CodeBlock.tsx | 2 +-
modelina-website/src/components/InfoModal.tsx | 18 +-
.../components/contexts/PlaygroundContext.tsx | 185 ++++++
.../src/components/playground/Content.tsx | 89 +++
.../components/playground/GeneratedModels.tsx | 154 ++---
.../playground/OptionsNavigation.tsx | 54 ++
.../playground/OutputNavigation.tsx | 26 +
.../src/components/playground/Playground.tsx | 578 ++++++------------
.../playground/PlaygroundOptions.tsx | 130 ++--
.../src/components/playground/Sidebar.tsx | 76 +++
.../src/components/playground/Tooltip.tsx | 23 +
.../options/CSharpGeneratorOptions.tsx | 38 +-
.../options/CplusplusGeneratorOptions.tsx | 8 +-
.../options/DartGeneratorOptions.tsx | 2 +-
.../playground/options/GeneralOptions.tsx | 86 +--
.../playground/options/GoGeneratorOptions.tsx | 8 +-
.../options/JavaGeneratorOptions.tsx | 40 +-
.../options/JavaScriptGeneratorOptions.tsx | 2 +-
.../options/KotlinGeneratorOptions.tsx | 8 +-
.../options/PhpGeneratorOptions.tsx | 12 +-
.../options/PythonGeneratorOptions.tsx | 2 +-
.../options/RustGeneratorOptions.tsx | 2 +-
.../options/TypeScriptGeneratorOptions.tsx | 76 +--
modelina-website/src/pages/playground.tsx | 38 +-
modelina-website/src/styles/globals.css | 21 +
27 files changed, 1048 insertions(+), 698 deletions(-)
create mode 100644 modelina-website/src/components/contexts/PlaygroundContext.tsx
create mode 100644 modelina-website/src/components/playground/Content.tsx
create mode 100644 modelina-website/src/components/playground/OptionsNavigation.tsx
create mode 100644 modelina-website/src/components/playground/OutputNavigation.tsx
create mode 100644 modelina-website/src/components/playground/Sidebar.tsx
create mode 100644 modelina-website/src/components/playground/Tooltip.tsx
diff --git a/modelina-website/package-lock.json b/modelina-website/package-lock.json
index 5b679dcfec..343dfd77d8 100644
--- a/modelina-website/package-lock.json
+++ b/modelina-website/package-lock.json
@@ -12,6 +12,7 @@
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/line-clamp": "^0.4.0",
"@tailwindcss/typography": "^0.5.9",
+ "@tippyjs/react": "^4.2.6",
"cssnano": "^5.1.14",
"js-base64": "^3.7.4",
"lodash": "^4.17.21",
@@ -20,6 +21,7 @@
"postcss": "^8.4.31",
"react": "18.2.0",
"react-dom": "18.2.0",
+ "react-icons": "^4.12.0",
"react-markdown": "^8.0.7",
"react-syntax-highlighter": "15.5.0",
"rehype-raw": "^6.1.1",
@@ -389,6 +391,15 @@
"node": ">= 8"
}
},
+ "node_modules/@popperjs/core": {
+ "version": "2.11.8",
+ "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
+ "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/popperjs"
+ }
+ },
"node_modules/@rushstack/eslint-patch": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz",
@@ -444,6 +455,18 @@
"tailwindcss": ">=3.0.0 || insiders"
}
},
+ "node_modules/@tippyjs/react": {
+ "version": "4.2.6",
+ "resolved": "https://registry.npmjs.org/@tippyjs/react/-/react-4.2.6.tgz",
+ "integrity": "sha512-91RicDR+H7oDSyPycI13q3b7o4O60wa2oRbjlz2fyRLmHImc4vyDwuUP8NtZaN0VARJY5hybvDYrFzhY9+Lbyw==",
+ "dependencies": {
+ "tippy.js": "^6.3.1"
+ },
+ "peerDependencies": {
+ "react": ">=16.8",
+ "react-dom": ">=16.8"
+ }
+ },
"node_modules/@trysound/sax": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz",
@@ -5476,6 +5499,14 @@
"react": "^18.2.0"
}
},
+ "node_modules/react-icons": {
+ "version": "4.12.0",
+ "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz",
+ "integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==",
+ "peerDependencies": {
+ "react": "*"
+ }
+ },
"node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@@ -6318,6 +6349,14 @@
"node": ">=0.8"
}
},
+ "node_modules/tippy.js": {
+ "version": "6.3.7",
+ "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz",
+ "integrity": "sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==",
+ "dependencies": {
+ "@popperjs/core": "^2.9.0"
+ }
+ },
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
@@ -7064,6 +7103,11 @@
"fastq": "^1.6.0"
}
},
+ "@popperjs/core": {
+ "version": "2.11.8",
+ "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
+ "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A=="
+ },
"@rushstack/eslint-patch": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz",
@@ -7109,6 +7153,14 @@
"postcss-selector-parser": "6.0.10"
}
},
+ "@tippyjs/react": {
+ "version": "4.2.6",
+ "resolved": "https://registry.npmjs.org/@tippyjs/react/-/react-4.2.6.tgz",
+ "integrity": "sha512-91RicDR+H7oDSyPycI13q3b7o4O60wa2oRbjlz2fyRLmHImc4vyDwuUP8NtZaN0VARJY5hybvDYrFzhY9+Lbyw==",
+ "requires": {
+ "tippy.js": "^6.3.1"
+ }
+ },
"@trysound/sax": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz",
@@ -10531,6 +10583,12 @@
"scheduler": "^0.23.0"
}
},
+ "react-icons": {
+ "version": "4.12.0",
+ "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz",
+ "integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==",
+ "requires": {}
+ },
"react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@@ -11124,6 +11182,14 @@
"thenify": ">= 3.1.0 < 4"
}
},
+ "tippy.js": {
+ "version": "6.3.7",
+ "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz",
+ "integrity": "sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==",
+ "requires": {
+ "@popperjs/core": "^2.9.0"
+ }
+ },
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
diff --git a/modelina-website/package.json b/modelina-website/package.json
index f098125689..4806ccb794 100644
--- a/modelina-website/package.json
+++ b/modelina-website/package.json
@@ -20,6 +20,7 @@
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/line-clamp": "^0.4.0",
"@tailwindcss/typography": "^0.5.9",
+ "@tippyjs/react": "^4.2.6",
"cssnano": "^5.1.14",
"js-base64": "^3.7.4",
"lodash": "^4.17.21",
@@ -28,6 +29,7 @@
"postcss": "^8.4.31",
"react": "18.2.0",
"react-dom": "18.2.0",
+ "react-icons": "^4.12.0",
"react-markdown": "^8.0.7",
"react-syntax-highlighter": "15.5.0",
"rehype-raw": "^6.1.1",
diff --git a/modelina-website/src/components/CodeBlock.tsx b/modelina-website/src/components/CodeBlock.tsx
index a1c3f63734..d834579b03 100644
--- a/modelina-website/src/components/CodeBlock.tsx
+++ b/modelina-website/src/components/CodeBlock.tsx
@@ -224,7 +224,7 @@ export default function CodeBlock({
className: 'pl-2 float-left left-0 sticky bg-code-editor-dark',
style: {}
}}
- lineNumberProps={(lineNumber: any) => {
+ linenumberprops={(lineNumber: any) => {
const isHighlighted = highlightedLines?.includes(lineNumber) || false;
return {
className: `${
diff --git a/modelina-website/src/components/InfoModal.tsx b/modelina-website/src/components/InfoModal.tsx
index 7b93ff2109..ac84d75c86 100644
--- a/modelina-website/src/components/InfoModal.tsx
+++ b/modelina-website/src/components/InfoModal.tsx
@@ -5,7 +5,7 @@ interface InfoModalProps {
children: React.ReactNode;
}
-export default function InfoModal(props: InfoModalProps){
+export default function InfoModal(props: InfoModalProps) {
const [showModal, setShowModal] = useState(false);
@@ -21,24 +21,24 @@ export default function InfoModal(props: InfoModalProps){
const MyModal = () => {
return (
- <>
-
-
-
>
)
}
- return(
+ return (
<>