Skip to content

Commit

Permalink
docs: add katacoda tutorial (kubernetes#926)
Browse files Browse the repository at this point in the history
Signed-off-by: Yue Yang <[email protected]>
  • Loading branch information
g1eny0ung authored Sep 18, 2020
1 parent cd0af96 commit b3314f5
Show file tree
Hide file tree
Showing 4 changed files with 443 additions and 370 deletions.
3 changes: 2 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ module.exports = {
activeBasePath: 'docs',
label: 'Documentation',
},
{ to: 'blog', activeBasePath: 'blog', label: 'Blog' },
{ to: 'interactiveTutorial', label: 'Interactive Tutorial' },
{ to: 'blog', activeBasePath: 'blog', label: 'Blog', position: 'right' },
{
href: 'https://github.com/chaos-mesh/chaos-mesh',
label: 'GitHub',
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy"
"deploy": "docusaurus deploy",
"clean": "rimraf build"
},
"dependencies": {
"@docusaurus/core": "^2.0.0-alpha.58",
"@docusaurus/core": "^2.0.0-alpha.64",
"@docusaurus/preset-classic": "^2.0.0-alpha.58",
"clsx": "^1.1.1",
"react": "^16.8.4",
Expand All @@ -26,5 +27,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"rimraf": "^3.0.2"
}
}
38 changes: 38 additions & 0 deletions src/pages/interactiveTutorial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { useEffect } from 'react'

import Layout from '@theme/Layout'

const useScript = (url) => {
useEffect(() => {
const script = document.createElement('script')

script.src = url
script.async = true

document.body.appendChild(script)

return () => {
document.body.removeChild(script)
}
}, [url])
}

const InteractiveTutorial = () => {
useScript('//katacoda.com/embed.js')

return (
<Layout
title="Interactive Tutorial"
description="This interactive tutorial will use Katacoda to cover an introduction to Chaos Mesh and guides the learner through two experiments that coincide with the Chaos Mesh documentation"
>
<div
id="katacoda-scenario-1"
data-katacoda-id="javajon/courses/kubernetes-chaos/chaos-mesh"
data-katacoda-color="172d72"
style={{ height: 'calc(100vh - 60px)' }}
></div>
</Layout>
)
}

export default InteractiveTutorial
Loading

0 comments on commit b3314f5

Please sign in to comment.