Skip to content

Commit

Permalink
update: promote v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekall committed Oct 9, 2022
1 parent 383d3f1 commit 9c453f6
Show file tree
Hide file tree
Showing 18 changed files with 167 additions and 79 deletions.
83 changes: 60 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,79 @@
<img src="https://raw.githubusercontent.com/Nekall/template-react-app/3035507c3f946c17474380f68871d910fd1422f7/src/assets/images/react.svg" alt="react's logo" width="100" height="100">

## This is a basic template of a React application. Basically, there is a page system, the jsconfig, and the gitigniore is completed.
Basically I made it for me, but feel free to use it, improve it, customize it. Happy development :)
<img src="https://raw.githubusercontent.com/Nekall/template-react-app/3035507c3f946c17474380f68871d910fd1422f7/src/assets/images/react.svg" alt="react's logo" width="100" height="100">



## This is a <u>light</u> template of a React application. 🧚‍♂️

Basically I made it for me, but feel free to use it, improve it, customize it. Have a nice dev :)

(🧹 *All packages & files for creating tests or checking performance have been removed.*)



## Setup ⚙️

- Download .zip **or** `git clone` this repository.
- Execute `npm install`
- Execute `npm audit fix` (If necessary)
- Execute `npm start`, Voilà !


- Download .zip **or** `git clone` this repository.

- Execute `npm install`

You have a navbar component template, a page template, image import, fonts import, and a folder architecture already done. Enjoy ;)
- Execute `npm audit fix` (If necessary)

- Execute `npm start`, Voilà !



You have a navbar component template, a pages templates (*error page in case of wrong url*) , image import, fonts import, and a folder architecture already done. Enjoy ;)



## Customization 🎨

Change name & version in **package.json** :


Change name & version in **package.json** :

"name": "template",
"version": "0.0.0",


"name": "template",

"version": "0.0.0",




Change the logos in :

/public/favicon.ico
/public/logo192.png
/public/logo512.png


/public/favicon.ico

/public/logo192.png

/public/logo512.png



& html in `/public/index.html` :



<meta name="description" content="Web site created using create-react-app"/>

& html in `/public/index.html` :
<title>React App</title>

<meta name="description" content="Web site created using create-react-app"/>
<title>React App</title>


## Dependencies 🧰
- react
- react-dom
- react-router-dom
- react-scripts
- web-vitals
- sass

- [react](https://www.npmjs.com/package/react)

- [react-dom](https://www.npmjs.com/package/react-dom)

- [react-router-dom](https://www.npmjs.com/package/react-router-dom)

- [react-scripts](https://www.npmjs.com/package/react-scripts)

- [node-sass](https://www.npmjs.com/package/node-sass)
23 changes: 8 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
{
"name": "template",
"version": "0.3.0",
"version": "0.4.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.1.1",
"@testing-library/user-event": "^13.5.0",
"node-sass": "^7.0.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
"node-sass": "^7.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.4.2",
"react-scripts": "^5.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"build": "react-scripts build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
"react-app"
]
},
"browserslist": {
Expand Down
8 changes: 5 additions & 3 deletions src/components/Navbar/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import "./style.scss";
import { Link } from "react-router-dom";
import reactLogo from "assets/images/react.svg";

// Styles
import styles from "./styles.module.scss";

const Navbar = () => (
<nav className="navbar">
<img className="logo-react" src={reactLogo} alt="react logo" />
<nav className={styles.__navbar}>
<img className={styles.__logo_react} src={reactLogo} alt="react logo" />
<Link to="/">Home</Link>
<Link to="/page-1">Page 1</Link>
<Link to="/page-2">Page 2</Link>
Expand Down
27 changes: 0 additions & 27 deletions src/components/Navbar/style.scss

This file was deleted.

28 changes: 28 additions & 0 deletions src/components/Navbar/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@import "../../style/colors.scss";

.__navbar {
background-color: $color-grey;
padding: 10px;

.__logo_react {
width: 35px;
margin: 0 10px;
filter: invert(100%) sepia(11%) saturate(6138%) hue-rotate(180deg)
brightness(107%) contrast(116%);
animation: rotate 5s linear infinite;
}

a {
color: $color-white;
font-weight: bold;
font-size: 20px;
margin: 0 5px;
&:hover {
color: $light-grey;
}
}
}

@keyframes rotate{
to{ transform: rotate(360deg); }
}
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";

// Components
import Navbar from "./components/Navbar";

// Pages
import Home from "./pages/Home";
import Page1 from "./pages/Page1";
import Page2 from "./pages/Page2";
import ErrorPage from "./pages/ErrorPage";

// Styles
import "./index.scss";

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
Expand All @@ -16,6 +23,7 @@ root.render(
<Route path="/" element={<Home />} />
<Route path="/page-1" element={<Page1 />} />
<Route path="/page-2" element={<Page2 />} />
<Route path="*" element={<ErrorPage />} />
</Routes>
</Router>
</React.StrictMode>
Expand Down
2 changes: 1 addition & 1 deletion src/index.css → src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ body {
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
10 changes: 10 additions & 0 deletions src/pages/ErrorPage/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Styles
import styles from "../../style/pages/error-page.module.scss";

const ErrorPage = () => (
<section className={styles.__error_page}>
<h1>404 Not Found</h1>
</section>
);

export default ErrorPage;
7 changes: 5 additions & 2 deletions src/pages/Home/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Styles
import styles from "../../style/pages/home.module.scss";

const Home = () => {
console.log("Welcome to the React template made by Nekå ✨");
return (
<>
<section className={styles.__home}>
<h1>Home</h1>
</>
</section>
);
};
export default Home;
7 changes: 5 additions & 2 deletions src/pages/Page1/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Styles
import styles from "../../style/pages/page1.module.scss";

const Page1 = () => {
//Your JS here.
return (
<>
<section className={styles.__page1}>
<h1>Page 1</h1>
</>
</section>
);
};
export default Page1;
7 changes: 5 additions & 2 deletions src/pages/Page2/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Styles
import styles from "../../style/pages/page2.module.scss";

const Page2 = () => {
//Your JS here.
return (
<>
<section className={styles.__page2}>
<h1>Page 2</h1>
</>
</section>
);
};
export default Page2;
2 changes: 1 addition & 1 deletion src/style/colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ $color-black: #000000;
$color-grey: #23272a;
$dark-grey: #484848;
$color-white: #ffffff;
$light-grey: #99aab5;
$light-grey: #99aab5;
2 changes: 1 addition & 1 deletion src/style/fonts.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@font-face {
font-family: "Avenir Next";
src: url("../assets/fonts/AvenirNextLTPro-Regular.otf");
}
}
2 changes: 1 addition & 1 deletion src/style/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ body {
margin: 0;
padding: 0;
background-color: #2c2f33;
}
}
7 changes: 7 additions & 0 deletions src/style/pages/error-page.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.__error_page {
text-align: center;

h1 {
text-transform: uppercase;
}
}
7 changes: 7 additions & 0 deletions src/style/pages/home.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.__home {
text-align: center;

h1 {
text-transform: uppercase;
}
}
7 changes: 7 additions & 0 deletions src/style/pages/page1.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.__page1 {
text-align: left;

h1 {
text-transform: uppercase;
}
}
7 changes: 7 additions & 0 deletions src/style/pages/page2.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.__page2 {
text-align: right;

h1 {
text-transform: uppercase;
}
}

0 comments on commit 9c453f6

Please sign in to comment.