diff --git a/pages/course/svg/main-svg-elements.tsx b/pages/course/svg/main-svg-elements.tsx index 349ebbf8..675d1909 100644 --- a/pages/course/svg/main-svg-elements.tsx +++ b/pages/course/svg/main-svg-elements.tsx @@ -175,6 +175,10 @@ export default function Home() { title: A first barplot!, content: , }, + { + title: Vertical barplot 🤕, + content: , + }, ]} /> @@ -280,7 +284,32 @@ const exercices: Exercise[] = [ ), - practiceSandbox: 'exercise/SvgOverflowPractice', - solutionSandbox: 'exercise/SvgOverflowSolution', + practiceSandbox: 'exercise/SvgFourRectsPractice', + solutionSandbox: 'exercise/SvgFourRectsSolution', + }, + + { + whyItMatters: ( + <> +

Rectangles are drawn from top to bottom in SVG.

+

+ As a result, there is always a bit of thinking overhead to perform + each time. Annoying but necessary! +

+ + ), + toDo: ( + + ), + + practiceSandbox: 'exercise/SvgFourRectsVerticalPractice', + solutionSandbox: 'exercise/SvgFourRectsVerticalSolution', }, ]; diff --git a/viz/exercise/SvgFourRectsVerticalPractice/Graph.tsx b/viz/exercise/SvgFourRectsVerticalPractice/Graph.tsx new file mode 100644 index 00000000..258b569d --- /dev/null +++ b/viz/exercise/SvgFourRectsVerticalPractice/Graph.tsx @@ -0,0 +1,9 @@ +// margin of 30 above and below + +export const Graph = () => { + return ( + + + + ); +}; diff --git a/viz/exercise/SvgFourRectsVerticalPractice/index.js b/viz/exercise/SvgFourRectsVerticalPractice/index.js new file mode 100644 index 00000000..fa564d27 --- /dev/null +++ b/viz/exercise/SvgFourRectsVerticalPractice/index.js @@ -0,0 +1,6 @@ +// File used to render something in codesandbox only +import ReactDOM from 'react-dom'; +import { Graph } from './Graph'; + +const rootElement = document.getElementById('root'); +ReactDOM.render(, rootElement); diff --git a/viz/exercise/SvgFourRectsVerticalPractice/package.json b/viz/exercise/SvgFourRectsVerticalPractice/package.json new file mode 100644 index 00000000..ac08117a --- /dev/null +++ b/viz/exercise/SvgFourRectsVerticalPractice/package.json @@ -0,0 +1,28 @@ +{ + "name": "pie-chart-basic", + "version": "1.0.0", + "description": "", + "keywords": [], + "main": "index.js", + "dependencies": { + "react": "17.0.2", + "react-dom": "17.0.2", + "react-scripts": "4.0.0" + }, + "devDependencies": { + "@babel/runtime": "7.13.8", + "typescript": "4.1.3" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test --env=jsdom", + "eject": "react-scripts eject" + }, + "browserslist": [ + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" + ] +} diff --git a/viz/exercise/SvgFourRectsVerticalSolution/Graph.tsx b/viz/exercise/SvgFourRectsVerticalSolution/Graph.tsx new file mode 100644 index 00000000..ac01a80d --- /dev/null +++ b/viz/exercise/SvgFourRectsVerticalSolution/Graph.tsx @@ -0,0 +1,34 @@ +export const Graph = () => { + return ( + + + + + + + ); +}; diff --git a/viz/exercise/SvgFourRectsVerticalSolution/index.js b/viz/exercise/SvgFourRectsVerticalSolution/index.js new file mode 100644 index 00000000..fa564d27 --- /dev/null +++ b/viz/exercise/SvgFourRectsVerticalSolution/index.js @@ -0,0 +1,6 @@ +// File used to render something in codesandbox only +import ReactDOM from 'react-dom'; +import { Graph } from './Graph'; + +const rootElement = document.getElementById('root'); +ReactDOM.render(, rootElement); diff --git a/viz/exercise/SvgFourRectsVerticalSolution/package.json b/viz/exercise/SvgFourRectsVerticalSolution/package.json new file mode 100644 index 00000000..ac08117a --- /dev/null +++ b/viz/exercise/SvgFourRectsVerticalSolution/package.json @@ -0,0 +1,28 @@ +{ + "name": "pie-chart-basic", + "version": "1.0.0", + "description": "", + "keywords": [], + "main": "index.js", + "dependencies": { + "react": "17.0.2", + "react-dom": "17.0.2", + "react-scripts": "4.0.0" + }, + "devDependencies": { + "@babel/runtime": "7.13.8", + "typescript": "4.1.3" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test --env=jsdom", + "eject": "react-scripts eject" + }, + "browserslist": [ + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" + ] +}