diff --git a/README.md b/README.md index b9f558d..8ee45bb 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,75 @@ -# React and Redux +![](https://img.shields.io/badge/Microverse-blueviolet) -If you are not familiar with linters and GitHub Actions, read [root level README](../README.md). +# Project Name : Space-x Traveler Hub -## Set-up GitHub Actions +>[Space-x](https://space-x-traveler.netlify.app/) is a web application for a company that provides commercial and scientific space travel services. The application is with the real live data from the SpaceX API and allow users to book rockets and join selected space missions. +> +> + ## Project view + +![Screen](https://user-images.githubusercontent.com/101924220/179762369-de3f9ec2-9a9f-4bcb-8dd9-a39f151f6b79.png) -This GitHub Action is going to run [ESLint](https://eslint.org/) and [Stylelint](https://stylelint.io/) to help you find style issues. +> In order to achieve this project I used some resources and technologies listed below : +## Built With -[Stylelint](https://stylelint.io/) is a linter for your stylesheets that helps you avoid errors and enforce conventions. +- Major languages : JavaScript , JSX and CSS +- Promise based HTTP : `axios` +- Toolchain : `Babel` +- Library and Framework : `React, React-redux, Jest, React-test-renderer` +- Technologies used : Github, Git, Gitflow and Linters -[ESLint](https://eslint.org/) is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code, with the goal of making code more consistent and avoiding bugs. +## Live Demo (Not ava) -Please do the following **steps in this order**: +Click [Here](https://space-x-traveler.netlify.app/) To open the live demo -1. In the first commit of your feature branch create a `.github/workflows` folder and add a copy of [`.github/workflows/linters.yml`](.github/workflows/linters.yml) to that folder. - - **Remember** to use the file linked above - - **Remember** that `.github` folder starts with a dot. -2. **Do not make any changes in config files - they represent style guidelines that you share with your team - which is a group of all Microverse students.** - - If you think that change is necessary - open a [Pull Request in this repository](../README.md#contributing) and let your code reviewer know about it. -3. When you open your first pull request you should see the result of the GitHub Actions: +## Getting Started -![gh actions checks](../assets/images/gh-actions-eslint-stylelint-checks.png) +To get a local copy up and running follow these simple example steps. -Click on the `Details` link to see the full output and the errors that need to be fixed: +### Prerequisites โ™ป๏ธ -![gh actions failing checks](../assets/images/gh-actions-html-css-failing-checks.png) +- A personal computer connected to the internet; +- Have a working and updated browser. +- Have a local version control like git installed on your computer +- Have an account on Github, as an online/remote Version Control System +- Code editor (Visual studio code, sublime text, notepad++, ...) installed on your computer; +- To be okay with javaScript ES6 +- Knowledge of HTML and CSS. -## Set-up linters in your local env +### Setup ๐ŸŽฐ -### ESLint +- Click the [me](https://github.com/Chrissiku/Space-x) and you'll land on the pure repository; +- click on the green (๐ŸŸข) button with `Code` Inscription; +- You can choose to download the project or just clone it if you are familiar with Git and Github; +- Follow normal step once download in your computer and use it as it's yours. -1. Run - ``` - npm install --save-dev eslint@7.x eslint-config-airbnb@18.x eslint-plugin-import@2.x eslint-plugin-jsx-a11y@6.x eslint-plugin-react@7.x eslint-plugin-react-hooks@4.x @babel/eslint-parser@7.x @babel/core@7.x @babel/plugin-syntax-jsx@7.x @babel/preset-react@7.x @babel/preset-react@7.x - ``` - *not sure how to use npm? Read [this](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).* -2. Copy [.eslintrc.json](./.eslintrc.json) and [.babelrc](./.babelrc) to the root directory of your project. -3. **Do not make any changes in config files - they represent style guidelines that you share with your team - which is a group of all Microverse students.** - - If you think that change is necessary - open a [Pull Request in this repository](../README.md#contributing) and let your code reviewer know about it. -4. Run `npx eslint .` on the root of your directory of your project. -5. Fix linter errors. -6. **IMPORTANT NOTE**: feel free to research [auto-correct options for Stylelint](https://stylelint.io/user-guide/cli#autofixing-errors) if you get a flood of errors but keep in mind that correcting style errors manually will help you to make a habit of writing a clean code! +### Install -### Stylelint +- If you are familiar with git, Run `npm install` to get all dependencies required to run the linters checks, otherwise use the downloaded project on your computer without testing files -1. Run +### Run test ๐Ÿงช - ``` - npm install --save-dev stylelint@13.x stylelint-scss@3.x stylelint-config-standard@21.x stylelint-csstree-validator@1.x - ``` +> Run the command bellow inside your `git bash` or command line interface.. - *not sure how to use npm? Read [this](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).* +- `npm run start` : to run the project in your default web Browser +- `npx stylelint "**/*.{css,scss}"` : for the `css` codebase and use of best practices. you can add +- `npx eslint .` : for the `JavaScript` codebase and use of best practices +- > Note that you can add `--fix` keyword to the command for `Css` and/or `JavaScript` to make sure that you avoid all errors coming from your `code editor` -2. Copy [.stylelintrc.json](./.stylelintrc.json) to the root directory of your project. -3. **Do not make any changes in config files - they represent style guidelines that you share with your team - which is a group of all Microverse students.** - - If you think that change is necessary - open a [Pull Request in this repository](../README.md#contributing) and let your code reviewer know about it. -4. Run `npx stylelint "**/*.{css,scss}"` on the root of your directory of your project. -5. Fix linter errors. -6. **IMPORTANT NOTE**: feel free to research [auto-correct options for Stylelint](https://stylelint.io/user-guide/cli#autofixing-errors) if you get a flood of errors but keep in mind that correcting style errors manually will help you to make a habit of writing a clean code! +## Author -## Test/Deployment Actions +๐Ÿ‘ค **Chris Siku** -Feel free to add your own deployment actions which can run your tests and deploy to Heroku. +- GitHub: [@githubhandle](https://github.com/Chrissiku) +- Twitter: [@twitterhandle](https://twitter.com/christian_siku) +- LinkedIn: [LinkedIn](https://www.linkedin.com/in/chris-siku-4bb53b232/) -Make sure that you do not modify the [`.github/workflows/linters.yml`](.github/workflows/linters.yml) but that you create a separe GitHub Action workflow file for that. +๐Ÿ‘ค **Grace Muthui** + +- GitHub: [@Grayce Muthui](https://github.com/Graycemuthui) +- Twitter: [@Grayce_Muthui](https://twitter.com/Grayce_Muthui) +- LinkedIn: [@Grayce Muthui](https://www.linkedin.com/in/grayce-muthui/) + +## ๐Ÿค Contributing + +Contributions, issues, and feature requests are welcome! diff --git a/package-lock.json b/package-lock.json index 21105dc..83b71ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "react-redux": "^8.0.2", "react-router-dom": "^6.3.0", "react-scripts": "5.0.1", + "react-test-renderer": "^18.2.0", "redux": "^4.2.0", "redux-logger": "^3.0.6", "redux-thunk": "^2.4.1", @@ -15592,6 +15593,36 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/react-shallow-renderer": { + "version": "16.15.0", + "resolved": "https://registry.npmjs.org/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz", + "integrity": "sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==", + "dependencies": { + "object-assign": "^4.1.1", + "react-is": "^16.12.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependencies": { + "react": "^16.0.0 || ^17.0.0 || ^18.0.0" + } + }, + "node_modules/react-test-renderer": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz", + "integrity": "sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==", + "dependencies": { + "react-is": "^18.2.0", + "react-shallow-renderer": "^16.15.0", + "scheduler": "^0.23.0" + }, + "peerDependencies": { + "react": "^18.2.0" + } + }, + "node_modules/react-test-renderer/node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" + }, "node_modules/react-transition-group": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz", @@ -30105,6 +30136,32 @@ } } }, + "react-shallow-renderer": { + "version": "16.15.0", + "resolved": "https://registry.npmjs.org/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz", + "integrity": "sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==", + "requires": { + "object-assign": "^4.1.1", + "react-is": "^16.12.0 || ^17.0.0 || ^18.0.0" + } + }, + "react-test-renderer": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz", + "integrity": "sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==", + "requires": { + "react-is": "^18.2.0", + "react-shallow-renderer": "^16.15.0", + "scheduler": "^0.23.0" + }, + "dependencies": { + "react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" + } + } + }, "react-transition-group": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz", diff --git a/package.json b/package.json index 195ab2e..b93d15d 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "react-redux": "^8.0.2", "react-router-dom": "^6.3.0", "react-scripts": "5.0.1", + "react-test-renderer": "^18.2.0", "redux": "^4.2.0", "redux-logger": "^3.0.6", "redux-thunk": "^2.4.1", diff --git a/src/App.css b/src/App.css index e8f3029..f4ba792 100644 --- a/src/App.css +++ b/src/App.css @@ -43,12 +43,19 @@ body { gap: 20px; } -.navbar .nav-link .nav-link { +.navbar .nav-link a { + text-decoration: none; + font-size: 18px; color: blue; - font-size: 20px; + transition: all 0.3s; +} + +.navbar .nav-link a.active-link { + text-decoration: underline; + text-underline-offset: 2px; } -.navbar .nav-link .nav-link .link { +.unselected { text-decoration: none; } diff --git a/src/App.test.js b/src/App.test.js deleted file mode 100644 index 1f03afe..0000000 --- a/src/App.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import App from './App'; - -test('renders learn react link', () => { - render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/src/assets/Screen.png b/src/assets/Screen.png new file mode 100644 index 0000000..7937e51 Binary files /dev/null and b/src/assets/Screen.png differ diff --git a/src/components/Header/Navbar.jsx b/src/components/Header/Navbar.jsx index af38e4e..101bb58 100644 --- a/src/components/Header/Navbar.jsx +++ b/src/components/Header/Navbar.jsx @@ -9,16 +9,14 @@ import routes from "../../assets/routes"; const NavMenu = () => ( ); diff --git a/src/tests/Mission.test.js b/src/tests/Mission.test.js new file mode 100644 index 0000000..feb7c56 --- /dev/null +++ b/src/tests/Mission.test.js @@ -0,0 +1,17 @@ +/* eslint-disable linebreak-style */ +/* eslint-disable comma-dangle */ +/* eslint-disable quotes */ +import React from "react"; +import TestRenderer from "react-test-renderer"; +import { Provider } from "react-redux"; +import store from "../Redux/ConfigureStore"; +import Missions from "../components/Missions/Missions"; + +it("Missions render correctly", () => { + const Tree = TestRenderer.create( + + + + ); + expect(Tree).toMatchSnapshot(); +}); diff --git a/src/tests/Profile.test.js b/src/tests/Profile.test.js new file mode 100644 index 0000000..522e63c --- /dev/null +++ b/src/tests/Profile.test.js @@ -0,0 +1,17 @@ +/* eslint-disable linebreak-style */ +/* eslint-disable comma-dangle */ +/* eslint-disable quotes */ +import React from "react"; +import TestRenderer from "react-test-renderer"; +import { Provider } from "react-redux"; +import store from "../Redux/ConfigureStore"; +import Profile from "../components/Profile/profile"; + +it("Profile render correctly", () => { + const Tree = TestRenderer.create( + + + + ); + expect(Tree).toMatchSnapshot(); +}); diff --git a/src/tests/Rockets.test.js b/src/tests/Rockets.test.js new file mode 100644 index 0000000..6ad6f32 --- /dev/null +++ b/src/tests/Rockets.test.js @@ -0,0 +1,17 @@ +/* eslint-disable linebreak-style */ +/* eslint-disable comma-dangle */ +/* eslint-disable quotes */ +import React from "react"; +import TestRenderer from "react-test-renderer"; +import { Provider } from "react-redux"; +import store from "../Redux/ConfigureStore"; +import Rockets from "../components/Rockets/Rockets"; + +it("Rockets render correctly", () => { + const Tree = TestRenderer.create( + + + + ); + expect(Tree).toMatchSnapshot(); +}); diff --git a/src/tests/__snapshots__/Mission.test.js.snap b/src/tests/__snapshots__/Mission.test.js.snap new file mode 100644 index 0000000..af31d75 --- /dev/null +++ b/src/tests/__snapshots__/Mission.test.js.snap @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Missions render correctly 1`] = ` +
+ + + + + + + + + + +
+ Mission + + Description + + Status + + +
+
+`; diff --git a/src/tests/__snapshots__/Profile.test.js.snap b/src/tests/__snapshots__/Profile.test.js.snap new file mode 100644 index 0000000..1eff187 --- /dev/null +++ b/src/tests/__snapshots__/Profile.test.js.snap @@ -0,0 +1,34 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Profile render correctly 1`] = ` +
+
+
+

+ My Missions +

+
+
+
+

+ My Rockets +

+
+
+
+
+`; diff --git a/src/tests/__snapshots__/Rockets.test.js.snap b/src/tests/__snapshots__/Rockets.test.js.snap new file mode 100644 index 0000000..ef7319c --- /dev/null +++ b/src/tests/__snapshots__/Rockets.test.js.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rockets render correctly 1`] = ` +
+`;