├── jsconfig.json ├── images └── demo.png ├── public ├── robots.txt ├── favicon.ico ├── logo192.png ├── logo512.png ├── manifest.json └── index.html ├── babel.config.js ├── src ├── components │ ├── About.js │ ├── NavBar.js │ ├── Home.js │ └── App.js ├── index.js ├── data │ └── data.js ├── index.css └── __tests__ │ ├── Home.test.js │ ├── NavBar.test.js │ └── About.test.js ├── .canvas ├── .gitignore ├── .github └── workflows │ └── canvas-sync-ruby-update.yml ├── package.json ├── LICENSE.md ├── CONTRIBUTING.md └── README.md /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "typeAcquisition": { 3 | "include": ["jest"] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /images/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/react-hooks-jsx-lab/HEAD/images/demo.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/react-hooks-jsx-lab/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/react-hooks-jsx-lab/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/react-hooks-jsx-lab/HEAD/public/logo512.png -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | "@babel/preset-env", 4 | ["@babel/preset-react", { runtime: "automatic" }], 5 | ], 6 | }; 7 | -------------------------------------------------------------------------------- /src/components/About.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { image } from "../data/data"; 3 | 4 | function About() { 5 | return
About
; 6 | } 7 | 8 | export default About; 9 | -------------------------------------------------------------------------------- /src/components/NavBar.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | function NavBar() { 4 | // update the JSX being returned! 5 | return ; 6 | } 7 | 8 | export default NavBar; 9 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import "./index.css"; 4 | import App from "./components/App"; 5 | 6 | ReactDOM.render(, document.getElementById("root")); 7 | -------------------------------------------------------------------------------- /src/components/Home.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { name, city } from "../data/data.js"; 3 | 4 | function Home() { 5 | // update the JSX being returned! 6 | return
Home
; 7 | } 8 | 9 | export default Home; 10 | -------------------------------------------------------------------------------- /src/data/data.js: -------------------------------------------------------------------------------- 1 | // use these variables in your JSX (update them with your own name and city!) 2 | const name = "Liza"; 3 | const city = "New York"; 4 | 5 | const image = "https://i.imgur.com/mV8PQxj.gif"; 6 | 7 | export { name, city, image }; 8 | -------------------------------------------------------------------------------- /src/components/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import NavBar from "./NavBar"; 3 | import Home from "./Home"; 4 | import About from "./About"; 5 | 6 | function App() { 7 | return ( 8 |
9 | 10 | 11 | 12 |
13 | ); 14 | } 15 | 16 | export default App; 17 | -------------------------------------------------------------------------------- /.canvas: -------------------------------------------------------------------------------- 1 | --- 2 | :lessons: 3 | - :id: 224946 4 | :course_id: 6667 5 | :canvas_url: https://learning.flatironschool.com/courses/6667/assignments/224946 6 | :type: assignment 7 | - :id: 263375 8 | :course_id: 7553 9 | :canvas_url: https://learning.flatironschool.com/courses/7553/assignments/263375 10 | :type: assignment 11 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/node 2 | 3 | .DS_Store 4 | 5 | ### Node ### 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | 11 | # Runtime data 12 | pids 13 | *.pid 14 | *.seed 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directories 23 | node_modules 24 | jspm_packages 25 | 26 | # Optional npm cache directory 27 | .npm 28 | 29 | # Optional REPL history 30 | .node_repl_history 31 | 32 | # Learn-specific .results.json 33 | .results.json 34 | 35 | # Ignore ESLint files 36 | .eslintcache -------------------------------------------------------------------------------- /.github/workflows/canvas-sync-ruby-update.yml: -------------------------------------------------------------------------------- 1 | name: Sync with Canvas Ruby v2.7 2 | 3 | on: 4 | push: 5 | branches: [master, main] 6 | paths: 7 | - 'README.md' 8 | 9 | jobs: 10 | sync: 11 | name: Sync with Canvas 12 | 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v2 17 | 18 | - name: Set up Ruby 19 | uses: ruby/setup-ruby@v1 20 | with: 21 | ruby-version: 2.7 22 | 23 | - name: Install github-to-canvas 24 | run: gem install github-to-canvas 25 | 26 | # Secret stored in learn-co-curriculum Settings/Secrets 27 | - name: Sync from .canvas file 28 | run: github-to-canvas -a -lr 29 | env: 30 | CANVAS_API_KEY: ${{ secrets.CANVAS_API_KEY }} 31 | CANVAS_API_PATH: ${{ secrets.CANVAS_API_PATH }} 32 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | } 6 | 7 | body { 8 | font-family: "Roboto", sans-serif; 9 | font-size: 16px; 10 | } 11 | 12 | h1, 13 | h2, 14 | h3, 15 | h4, 16 | h5, 17 | h6 { 18 | font-family: "Playfair Display", serif; 19 | margin-bottom: 1em; 20 | } 21 | 22 | nav { 23 | position: fixed; 24 | top: 0; 25 | left: 0; 26 | right: 0; 27 | } 28 | 29 | nav a { 30 | display: inline-block; 31 | padding: 0.5rem 1rem; 32 | margin: 0 1rem; 33 | text-decoration: none; 34 | font-size: 1.2em; 35 | color: firebrick; 36 | border-bottom: 2px solid firebrick; 37 | transition: 0.1s; 38 | } 39 | 40 | nav a:hover, 41 | nav a:active { 42 | color: tomato; 43 | border-bottom: 2px solid tomato; 44 | } 45 | 46 | #home, 47 | #about { 48 | display: flex; 49 | align-items: center; 50 | justify-content: center; 51 | flex-direction: column; 52 | text-align: center; 53 | height: 50vh; 54 | min-height: 400px; 55 | padding: 1rem; 56 | } 57 | 58 | #home { 59 | background-color: cornsilk; 60 | } 61 | 62 | #about img { 63 | max-height: 50%; 64 | } 65 | -------------------------------------------------------------------------------- /src/__tests__/Home.test.js: -------------------------------------------------------------------------------- 1 | import "@testing-library/jest-dom"; 2 | import { render, screen } from "@testing-library/react"; 3 | import { name, city } from "../data/data"; 4 | import Home from "../components/Home"; 5 | 6 | test("renders a div with the correct ID", () => { 7 | const { container } = render(); 8 | 9 | expect(container.querySelector("#home")).toBeInTheDocument(); 10 | }); 11 | 12 | test("renders the h1 with the text 'Name is a Web Developer from City'", () => { 13 | render(); 14 | 15 | // Find an element with the text content `${name} is a Web Developer from ${city}` 16 | // This uses the variables defined in src/data/data.js 17 | const h1 = screen.queryByText(`${name} is a Web Developer from ${city}`); 18 | 19 | expect(h1).toBeInTheDocument(); 20 | expect(h1.tagName).toBe("H1"); // check that the element is a

21 | }); 22 | 23 | test("the h1 has a an inline style attribute with a color of 'firebrick'", () => { 24 | render(); 25 | 26 | const h1 = screen.queryByText(`${name} is a Web Developer from ${city}`); 27 | expect(h1).toHaveStyle({ color: "firebrick" }); 28 | }); 29 | -------------------------------------------------------------------------------- /src/__tests__/NavBar.test.js: -------------------------------------------------------------------------------- 1 | import "@testing-library/jest-dom"; 2 | import { render, screen } from "@testing-library/react"; 3 | 4 | import NavBar from "../components/NavBar"; 5 | 6 | test("renders a