├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
└── robots.txt
└── src
├── App.css
├── App.js
├── App.test.js
├── assets
├── gifs
│ ├── on-scroll.gif
│ └── responsive.gif
├── travel-01.jpg
├── travel-02.jpg
└── travel-03.jpg
├── components
├── Hero.css
├── Hero.js
├── Navbar.css
├── Navbar.js
├── Slider.css
└── Slider.js
├── index.css
├── index.js
├── logo.svg
├── reportWebVitals.js
└── setupTests.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 🌴travell
2 |
3 | ## Overview
4 |
5 | This project is a simple landing page built with React.
6 |
7 |
8 |
9 | ## Animation (onScroll)
10 | ###### Using [`Intersection Observer`](https://github.com/thebuilder/react-intersection-observer#readme)
11 |
12 |
13 | ## Responsive
14 |
15 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-landing-page-v1",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.14.1",
7 | "@testing-library/react": "^11.2.7",
8 | "@testing-library/user-event": "^12.8.3",
9 | "react": "^17.0.2",
10 | "react-dom": "^17.0.2",
11 | "react-icons": "^4.2.0",
12 | "react-intersection-observer": "^8.32.0",
13 | "react-scripts": "4.0.3",
14 | "web-vitals": "^1.1.2"
15 | },
16 | "scripts": {
17 | "start": "react-scripts start",
18 | "build": "react-scripts build",
19 | "test": "react-scripts test",
20 | "eject": "react-scripts eject"
21 | },
22 | "eslintConfig": {
23 | "extends": [
24 | "react-app",
25 | "react-app/jest"
26 | ]
27 | },
28 | "browserslist": {
29 | "production": [
30 | ">0.2%",
31 | "not dead",
32 | "not op_mini all"
33 | ],
34 | "development": [
35 | "last 1 chrome version",
36 | "last 1 firefox version",
37 | "last 1 safari version"
38 | ]
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DLabbate/react-landing-page-v1/0d8aa47817beb10cdf18e77a146aa6f2a1acf574/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 |
28 |
29 |
33 |
37 | React App
38 |
39 |
40 |
41 |
42 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DLabbate/react-landing-page-v1/0d8aa47817beb10cdf18e77a146aa6f2a1acf574/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DLabbate/react-landing-page-v1/0d8aa47817beb10cdf18e77a146aa6f2a1acf574/public/logo512.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App.css:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | margin: 0;
4 | padding: 0;
5 | font-family: "Montserrat", sans-serif;
6 | }
7 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import "./App.css";
2 | import travel_01 from "./assets/travel-01.jpg";
3 | import travel_02 from "./assets/travel-02.jpg";
4 | import travel_03 from "./assets/travel-03.jpg";
5 | import Hero from "./components/Hero";
6 | import Navbar from "./components/Navbar";
7 | import Slider from "./components/Slider";
8 |
9 | function App() {
10 | const navbarLinks = [
11 | { url: "#", title: "Home" },
12 | { url: "#", title: "Trips" },
13 | { url: "#", title: "Rewards" },
14 | ];
15 |
16 | return (
17 |
18 |
19 |
20 |
27 |
33 |
34 | );
35 | }
36 |
37 | export default App;
38 |
--------------------------------------------------------------------------------
/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render();
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/src/assets/gifs/on-scroll.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DLabbate/react-landing-page-v1/0d8aa47817beb10cdf18e77a146aa6f2a1acf574/src/assets/gifs/on-scroll.gif
--------------------------------------------------------------------------------
/src/assets/gifs/responsive.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DLabbate/react-landing-page-v1/0d8aa47817beb10cdf18e77a146aa6f2a1acf574/src/assets/gifs/responsive.gif
--------------------------------------------------------------------------------
/src/assets/travel-01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DLabbate/react-landing-page-v1/0d8aa47817beb10cdf18e77a146aa6f2a1acf574/src/assets/travel-01.jpg
--------------------------------------------------------------------------------
/src/assets/travel-02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DLabbate/react-landing-page-v1/0d8aa47817beb10cdf18e77a146aa6f2a1acf574/src/assets/travel-02.jpg
--------------------------------------------------------------------------------
/src/assets/travel-03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DLabbate/react-landing-page-v1/0d8aa47817beb10cdf18e77a146aa6f2a1acf574/src/assets/travel-03.jpg
--------------------------------------------------------------------------------
/src/components/Hero.css:
--------------------------------------------------------------------------------
1 | .hero {
2 | position: relative;
3 | width: 100%;
4 | height: 100vh;
5 | }
6 |
7 | .hero__image {
8 | width: 100%;
9 | height: 100%;
10 | object-fit: cover;
11 | position: absolute;
12 | }
13 |
14 | .hero__title {
15 | position: absolute;
16 | bottom: 15%;
17 | right: 10%;
18 | color: white;
19 | font-size: 4rem;
20 | padding: 15px;
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/Hero.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import "./Hero.css";
3 |
4 | const Hero = ({ imageSrc }) => {
5 | return (
6 |
7 |

8 |
Travel made simple.
9 |
10 | );
11 | };
12 |
13 | export default Hero;
14 |
--------------------------------------------------------------------------------
/src/components/Navbar.css:
--------------------------------------------------------------------------------
1 | .navbar {
2 | position: sticky;
3 | top: 0px;
4 | height: 70px;
5 | background-color: black;
6 | opacity: 0.75;
7 | display: flex;
8 | justify-content: space-between;
9 | align-items: center;
10 | padding: 0px 30px 0px 30px;
11 | margin-bottom: -70px;
12 | z-index: 5;
13 | }
14 |
15 | .navbar__logo {
16 | color: white;
17 | font-family: "MonteCarlo", cursive;
18 | font-size: 2.5rem;
19 | }
20 |
21 | /*
22 | This is the container for all the navbar links ( )
23 | */
24 | .navbar__list {
25 | display: flex;
26 | list-style: none;
27 | }
28 |
29 | /*
30 | This is a single item ( - ) in the list
31 | */
32 | .navbar__item {
33 | white-space: nowrap;
34 | }
35 |
36 | /*
37 | The anchor tag ( ) for the navbar links
38 | */
39 | .navbar__link {
40 | font-size: 0.85rem;
41 | text-decoration: none;
42 | color: rgb(255, 255, 255);
43 | text-align: center;
44 | padding: 10px;
45 | margin: 0px 5px;
46 | border-style: solid;
47 | border-width: 0px 0px 1px 0px;
48 | border-color: transparent;
49 | transition: 250ms;
50 | }
51 |
52 | .navbar__link:hover {
53 | border-color: white;
54 | transition: 250ms;
55 | }
56 |
57 | .navbar__menu {
58 | color: white;
59 | display: none;
60 | cursor: pointer;
61 | }
62 |
63 | @media screen and (max-width: 800px) {
64 | .navbar__list {
65 | display: flex;
66 | flex-direction: column;
67 | justify-content: space-evenly;
68 | align-items: center;
69 | top: 70px;
70 | left: -100%;
71 | width: 100%;
72 | height: 300px;
73 | position: absolute;
74 | transition: all 0.5s ease;
75 | }
76 |
77 | .navbar__list--active {
78 | left: 0;
79 | }
80 |
81 | .navbar__menu {
82 | display: block;
83 | }
84 |
85 | .navbar__item {
86 | width: 100%;
87 | display: flex;
88 | justify-content: center;
89 | align-items: center;
90 | border-radius: 0;
91 | flex: 1;
92 | }
93 |
94 | .navbar__link {
95 | display: flex;
96 | height: 100%;
97 | width: 100%;
98 | justify-content: center;
99 | align-items: center;
100 | margin: 0px;
101 | border-width: 0px;
102 | background-color: black;
103 | opacity: 0.75;
104 | }
105 |
106 | .navbar__link:hover {
107 | border-width: 0px;
108 | opacity: 0.9;
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/src/components/Navbar.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 | import "./Navbar.css";
3 | import { FiMenu, FiX } from "react-icons/fi";
4 |
5 | const Navbar = ({ navbarLinks }) => {
6 | // Determines if the "menu icon" was clicked or not. Note that this icon is only visible when the window width is small.
7 | const [menuClicked, setMenuClicked] = useState(false);
8 |
9 | const toggleMenuClick = () => {
10 | setMenuClicked(!menuClicked);
11 | };
12 |
13 | return (
14 |
41 | );
42 | };
43 |
44 | export default Navbar;
45 |
--------------------------------------------------------------------------------
/src/components/Slider.css:
--------------------------------------------------------------------------------
1 | .slider {
2 | display: flex;
3 | align-items: center;
4 | margin: 20px;
5 |
6 | opacity: 0;
7 | transform: scale(85%);
8 | transition: 2s;
9 | }
10 |
11 | .slider--zoom {
12 | opacity: 1;
13 | transform: scale(100%);
14 | transition: 2s;
15 | }
16 |
17 | .slider__image {
18 | width: 60%;
19 | }
20 |
21 | .slider__content {
22 | flex: 1;
23 | display: flex;
24 | flex-direction: column;
25 | justify-content: center;
26 | align-items: center;
27 | padding: 20px;
28 | text-align: center;
29 | }
30 |
31 | .slider__title {
32 | text-align: center;
33 | }
34 |
35 | @media screen and (max-width: 800px) {
36 | .slider {
37 | flex-direction: column;
38 | background-color: rgb(236, 236, 236);
39 | }
40 |
41 | .slider__image {
42 | width: 100%;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/components/Slider.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import "./Slider.css";
3 | import { useInView } from "react-intersection-observer";
4 |
5 | const Slider = ({ imageSrc, title, subtitle, flipped }) => {
6 | const { ref, inView } = useInView({
7 | /* Optional options */
8 | threshold: 0.4,
9 | });
10 |
11 | const renderContent = () => {
12 | if (!flipped) {
13 | return (
14 | <>
15 |
16 |
17 |
{title}
18 |
{subtitle}
19 |
20 | >
21 | );
22 | } else {
23 | return (
24 | <>
25 |
26 |
{title}
27 |
{subtitle}
28 |
29 |
30 | >
31 | );
32 | }
33 | };
34 |
35 | return (
36 |
37 | {renderContent()}
38 |
39 | );
40 | };
41 |
42 | export default Slider;
43 |
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------