├── .github └── FUNDING.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── fonts │ ├── Motiva-Sans-Bold.ttf │ └── Motiva-Sans-Light.ttf ├── img │ ├── icons │ │ ├── logo192.png │ │ └── logo512.png │ └── svg │ │ ├── developer.svg │ │ ├── github.svg │ │ ├── graphs.svg │ │ ├── linkedin.svg │ │ ├── logo.svg │ │ ├── medium.svg │ │ ├── notes.svg │ │ ├── product-launch.svg │ │ ├── scroll-top.svg │ │ ├── spain.svg │ │ ├── twitter.svg │ │ ├── united-states.svg │ │ └── waving.svg ├── index.html ├── manifest.json └── robots.txt ├── src ├── common │ ├── Button │ │ ├── index.tsx │ │ └── styles.ts │ ├── Container │ │ ├── index.tsx │ │ └── styles.ts │ ├── Input │ │ ├── index.tsx │ │ └── styles.ts │ ├── ScrollToTop │ │ ├── index.tsx │ │ └── styles.ts │ ├── SvgIcon │ │ └── index.tsx │ ├── TextArea │ │ ├── index.tsx │ │ └── styles.tsx │ ├── types.ts │ └── utils │ │ ├── useForm.tsx │ │ └── validationRules.ts ├── components │ ├── Block │ │ ├── index.tsx │ │ └── styles.ts │ ├── ContactForm │ │ ├── index.tsx │ │ ├── styles.ts │ │ └── types.ts │ ├── ContentBlock │ │ ├── index.tsx │ │ ├── styles.ts │ │ └── types.ts │ ├── Footer │ │ ├── index.tsx │ │ └── styles.ts │ ├── Header │ │ ├── index.tsx │ │ └── styles.ts │ └── MiddleBlock │ │ ├── index.tsx │ │ └── styles.tsx ├── content │ ├── AboutContent.json │ ├── ContactContent.json │ ├── IntroContent.json │ ├── MiddleBlockContent.json │ ├── MissionContent.json │ └── ProductContent.json ├── index.tsx ├── locales │ ├── en │ │ └── translation.json │ └── es │ │ └── translation.json ├── pages │ └── Home │ │ └── index.tsx ├── react-app-env.d.ts ├── router │ ├── config.ts │ └── index.tsx ├── styles │ └── styles.ts └── translation.ts ├── template.json └── tsconfig.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: "https://ko-fi.com/adrinlol" 4 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at l.qqbadze@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Lasha Kakabadze 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![landy](https://user-images.githubusercontent.com/48876996/121569479-e179db80-ca31-11eb-8a48-9c3de9b142f3.gif) 2 | 3 | ![Landy React Template License](https://img.shields.io/github/license/Adrinlol/landy-react-template) 4 | ![Landy React Template Release Date](https://img.shields.io/github/release-date/Adrinlol/landy-react-template) 5 | ![Landy React TemplateStars](https://img.shields.io/github/stars/Adrinlol/landy-react-template) 6 | ![Landy React Template Language](https://img.shields.io/github/languages/top/Adrinlol/landy-react-template) 7 | ![Landy React Template TypeScript](https://badgen.net/npm/types/tslib) 8 | 9 | ## Free React landing page template 10 | 11 | [Landy][Landy] is an open-source React landing page template written in TypeScript, designed for developers and startups, who want to create a quick and professional landing page for their business or project. 12 | 13 | This React template comes with multi-lingual support, smooth animations, set of ready to use sections and most importantly, all of the content is stored in the JSON files, so that you can manage the texts without having any prior knowledge in React.js. 14 | 15 | ## Table of contents 16 | 17 | - [Features](#features) 18 | - [Google Lighthouse](#google-lighthouse) 19 | - [Performance](#performance) 20 | - [Accessibility](#accessibility) 21 | - [Best Practices](#best-practices) 22 | - [SEO](#seo) 23 | - [Demo](#demo) 24 | - [Installation](#installation) 25 | - [Special Thanks](#special-thanks) 26 | - [Usage](#usage) 27 | - [License](#license) 28 | 29 | ## Features 30 | 31 | Your project will have everything you need to build a modern single-page React app: 32 | 33 | - 🎁 **Modern** – Template created using the latest features of React (State management using Hooks, Code-Splitting to reduce the bundle size) 34 | 35 | - 💻 **Responsive** – Highly responsive and reusable UI components, that change depending on the provided props 36 | 37 | - 🚀 **Fast** – Buttery smooth experience thanks to the implementation of best practices and no third party dependencies, resulting in PERFECT Google Lighthouse scores 38 | 39 | - 🏷 **TypeScript support** – Landy is written in TypeScript to improve the DX 40 | 41 | - 🌍 **Internationalization** - Prebuilt standalone file that works in every environment and doesn't require reloading the page to translate the content 42 | 43 | - 🛸 **Routing** - Each file inside the src/pages directory will generate its own route, so you don't have to manually handle the routing 44 | 45 | - 🤙 **Contact Form** - Contact form written in React Hooks, with uncontrolled form validation to reduce unnecessary performance penalty. You just need to provide the endpoint 46 | 47 | - ⚙️ **Maintenance** - All of the content is stored in the JSON files, so that you can easily manage the content of the website 48 | 49 | ## Google Lighthouse 50 | 51 | ![1](https://user-images.githubusercontent.com/48876996/121569366-c313e000-ca31-11eb-940c-187f556ff0d6.png) 52 | 53 | [Google Lighthouse][Google Lighthouse] is an open-source, automated tool for measuring the quality of web pages. Google Lighthouse audits performance, accessibility and search engine optimization of web pages. 54 | 55 | ### Performance 56 | 57 | Audits for metrics like first paint and time to interactive to determine lag. 58 | 59 | ### Accessibility 60 | 61 | Checks for common issues that may prevent users from accessing your content. 62 | 63 | ### Best Practices 64 | 65 | Looks for everything from HTTPS usage to correct image aspect ratios. 66 | 67 | ### SEO 68 | 69 | Checks for best practices to ensure your site is discoverable. 70 | 71 | 72 | ## Demo 73 | 74 | Check the live demo here 👉️ https://landy-web.netlify.app/ 75 | 76 | 77 | ### Installation 78 | 79 | You’ll need to have Node 10.16.0 or later version on your local development machine (but it’s not required on the server). I recommend using the latest LTS version. 80 | 81 | To create a new app, you have to: 82 | 83 | Begin by cloning this repository to establish your own local copy. This process is straightforward and ensures you have all the necessary files and resources at your fingertips. You can find step-by-step instructions in this helpful article: Cloning a [repository on GitHub.com](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository#cloning-a-repository). 84 | 85 | ## What's included 86 | 87 | - [antd][antd] - React UI library that contains a set of high quality components. 88 | - [react-awesome-reveal][react-awesome-reveal] - High performance library that adds reveal animations using the Intersection Observer API. 89 | - [styled-componets][styled-componets] - Variant on “CSS-in-JS”—which solves many of the problems with traditional CSS. 90 | - [i18next][i18next] - Internationalization-framework written in and for JavaScript. 91 | 92 | ## Special thanks 93 | 94 | [whoooa][whoooa] - Use fantastic, handmade illustrations with easily changeable colors and different styles. 95 | 96 | ## Usage 97 | 98 | Use it for whatever you want, and be sure to reach out to me on [Twitter](https://twitter.com/Adrinlolx) if you have any questions, or build something cool with it. 99 | 100 | ## License 101 | 102 | Licensed under the MIT license. 103 | 104 | 105 | [antd]: https://github.com/ant-design/ant-design 106 | [react-awesome-reveal]: https://www.npmjs.com/package/react-awesome-reveal 107 | [styled-componets]: https://github.com/styled-components/styled-components 108 | [i18next]: https://github.com/i18next/i18next 109 | [whoooa]: https://www.whoooa.rocks/ 110 | [Landy]: https://www.npmjs.com/package/cra-template-adrinlol 111 | [Google Lighthouse]: https://developers.google.com/web/tools/lighthouse 112 | 113 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@types/node": "^15.14.9", 7 | "@types/react": "^17.0.68", 8 | "@types/react-dom": "^17.0.21", 9 | "@types/react-router-dom": "^5.3.3", 10 | "@types/styled-components": "^5.1.28", 11 | "antd": "^4.24.14", 12 | "i18next": "^19.9.2", 13 | "i18next-browser-languagedetector": "^6.1.8", 14 | "i18next-xhr-backend": "^3.2.2", 15 | "react": "^18.2.0", 16 | "react-awesome-reveal": "^3.8.1", 17 | "react-dom": "^18.2.0", 18 | "react-i18next": "^11.18.6", 19 | "react-router-dom": "^5.3.4", 20 | "react-scripts": "^5.0.1", 21 | "styled-components": "^5.3.11", 22 | "typescript": "^4.9.5" 23 | }, 24 | "scripts": { 25 | "start": "react-scripts start", 26 | "build": "react-scripts build", 27 | "test": "react-scripts test", 28 | "eject": "react-scripts eject" 29 | }, 30 | "eslintConfig": { 31 | "extends": "react-app" 32 | }, 33 | "browserslist": { 34 | "production": [ 35 | ">0.2%", 36 | "not dead", 37 | "not op_mini all" 38 | ], 39 | "development": [ 40 | "last 1 chrome version", 41 | "last 1 firefox version", 42 | "last 1 safari version" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adrinlol/landy-react-template/64ab0ebfc779194baafba6d5ae35981a7ebb0e3b/public/favicon.ico -------------------------------------------------------------------------------- /public/fonts/Motiva-Sans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adrinlol/landy-react-template/64ab0ebfc779194baafba6d5ae35981a7ebb0e3b/public/fonts/Motiva-Sans-Bold.ttf -------------------------------------------------------------------------------- /public/fonts/Motiva-Sans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adrinlol/landy-react-template/64ab0ebfc779194baafba6d5ae35981a7ebb0e3b/public/fonts/Motiva-Sans-Light.ttf -------------------------------------------------------------------------------- /public/img/icons/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adrinlol/landy-react-template/64ab0ebfc779194baafba6d5ae35981a7ebb0e3b/public/img/icons/logo192.png -------------------------------------------------------------------------------- /public/img/icons/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adrinlol/landy-react-template/64ab0ebfc779194baafba6d5ae35981a7ebb0e3b/public/img/icons/logo512.png -------------------------------------------------------------------------------- /public/img/svg/developer.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/img/svg/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/img/svg/graphs.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /public/img/svg/linkedin.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/img/svg/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | Landy 3 | -------------------------------------------------------------------------------- /public/img/svg/medium.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/img/svg/notes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /public/img/svg/product-launch.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /public/img/svg/scroll-top.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /public/img/svg/spain.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /public/img/svg/twitter.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/img/svg/united-states.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /public/img/svg/waving.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 34 | Landy - React Template 35 | 36 | 37 | 38 |
39 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Landy", 3 | "name": "Landy - React Template", 4 | "icons": [ 5 | { 6 | "src": "img/icons/logo192.png", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "img/icons/logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "img/icons/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/common/Button/index.tsx: -------------------------------------------------------------------------------- 1 | import { StyledButton } from "./styles"; 2 | import { ButtonProps } from "../types"; 3 | 4 | export const Button = ({ color, children, onClick }: ButtonProps) => ( 5 | 6 | {children} 7 | 8 | ); 9 | -------------------------------------------------------------------------------- /src/common/Button/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const StyledButton = styled("button")<{ color?: string }>` 4 | background: ${(p) => p.color || "#2e186a"}; 5 | color: ${(p) => (p.color ? "#2E186A" : "#fff")}; 6 | font-size: 1rem; 7 | font-weight: 700; 8 | width: 100%; 9 | border: 1px solid #edf3f5; 10 | border-radius: 4px; 11 | padding: 13px 0; 12 | cursor: pointer; 13 | margin-top: 0.625rem; 14 | max-width: 180px; 15 | transition: all 0.3s ease-in-out; 16 | box-shadow: 0 16px 30px rgb(23 31 114 / 20%); 17 | 18 | &:hover, 19 | &:active, 20 | &:focus { 21 | color: #fff; 22 | border: 1px solid rgb(255, 130, 92); 23 | background-color: rgb(255, 130, 92); 24 | } 25 | `; 26 | -------------------------------------------------------------------------------- /src/common/Container/index.tsx: -------------------------------------------------------------------------------- 1 | import { StyledContainer } from "./styles"; 2 | import { ContainerProps } from "../types"; 3 | 4 | const Container = ({ border, children }: ContainerProps) => ( 5 | {children} 6 | ); 7 | 8 | export default Container; 9 | -------------------------------------------------------------------------------- /src/common/Container/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const StyledContainer = styled("div")<{ 4 | border?: boolean; 5 | }>` 6 | position: relative; 7 | width: 100%; 8 | max-width: 1200px; 9 | margin-right: auto; 10 | margin-left: auto; 11 | padding: 0 60px; 12 | overflow: hidden; 13 | border-top: ${(p) => (p.border ? "1px solid #CDD1D4" : "")}; 14 | 15 | @media only screen and (max-width: 1024px) { 16 | max-width: calc(100% - 68px); 17 | padding: 0 30px; 18 | } 19 | 20 | @media only screen and (max-width: 768px) { 21 | max-width: calc(100% - 38px); 22 | padding: 0 18px; 23 | } 24 | 25 | @media only screen and (max-width: 414px) { 26 | max-width: 100%; 27 | padding: 0 18px; 28 | } 29 | `; 30 | -------------------------------------------------------------------------------- /src/common/Input/index.tsx: -------------------------------------------------------------------------------- 1 | import { withTranslation } from "react-i18next"; 2 | import { Container, StyledInput } from "./styles"; 3 | import { Label } from "../TextArea/styles"; 4 | import { InputProps } from "../types"; 5 | 6 | const Input = ({ name, placeholder, onChange, t }: InputProps) => ( 7 | 8 | 9 | 15 | 16 | ); 17 | 18 | export default withTranslation()(Input); 19 | -------------------------------------------------------------------------------- /src/common/Input/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const Container = styled("div")` 4 | display: inline-block; 5 | width: 100%; 6 | padding: 10px 5px; 7 | `; 8 | 9 | export const StyledInput = styled("input")` 10 | font-size: 0.875rem; 11 | `; 12 | -------------------------------------------------------------------------------- /src/common/ScrollToTop/index.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback, useEffect, useState } from "react"; 2 | import { SvgIcon } from "../SvgIcon"; 3 | import { ScrollUpContainer } from "./styles"; 4 | 5 | const ScrollToTop = () => { 6 | const [showScroll, setShowScroll] = useState(false); 7 | 8 | const checkScrollTop = useCallback(() => { 9 | const offsetFromTop = window.scrollY; 10 | 11 | if (!showScroll && offsetFromTop > 350) { 12 | setShowScroll(true); 13 | } else if (offsetFromTop <= 350) { 14 | setShowScroll(false); 15 | } 16 | }, [showScroll]); 17 | 18 | useEffect(() => { 19 | window.addEventListener("scroll", checkScrollTop); 20 | return () => { 21 | window.removeEventListener("scroll", checkScrollTop); 22 | }; 23 | }, [checkScrollTop]); 24 | 25 | const scrollUp = () => { 26 | const element = document.getElementById("intro") as HTMLDivElement; 27 | element.scrollIntoView({ 28 | behavior: "smooth", 29 | block: "end", 30 | inline: "nearest", 31 | }); 32 | }; 33 | 34 | return ( 35 | 36 | 37 | 38 | ); 39 | }; 40 | 41 | export default ScrollToTop; 42 | -------------------------------------------------------------------------------- /src/common/ScrollToTop/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const ScrollUpContainer = styled("div")<{ 4 | show: boolean; 5 | }>` 6 | padding: 10px; 7 | position: fixed; 8 | right: 30px; 9 | bottom: 30px; 10 | z-index: 10; 11 | cursor: pointer; 12 | background: rgb(241, 242, 243); 13 | text-align: center; 14 | align-items: center; 15 | border-radius: 4px; 16 | transition: all 0.3s ease-in-out; 17 | visibility: ${(p) => (p.show ? "visible" : "hidden")}; 18 | opacity: ${(p) => (p.show ? "1" : "0")}; 19 | display: flex; 20 | 21 | &:hover, 22 | &:active, 23 | &:focus { 24 | background: rgb(224, 224, 224); 25 | } 26 | 27 | @media screen and (max-width: 1240px) { 28 | display: none; 29 | } 30 | `; 31 | -------------------------------------------------------------------------------- /src/common/SvgIcon/index.tsx: -------------------------------------------------------------------------------- 1 | import { SvgIconProps } from "../types"; 2 | 3 | export const SvgIcon = ({ src, width, height }: SvgIconProps) => ( 4 | {src} 5 | ); 6 | -------------------------------------------------------------------------------- /src/common/TextArea/index.tsx: -------------------------------------------------------------------------------- 1 | import { withTranslation } from "react-i18next"; 2 | import { StyledTextArea, StyledContainer, Label } from "./styles"; 3 | import { InputProps } from "../types"; 4 | 5 | const TextArea = ({ name, placeholder, onChange, t }: InputProps) => ( 6 | 7 | 8 | 14 | 15 | ); 16 | 17 | export default withTranslation()(TextArea); 18 | -------------------------------------------------------------------------------- /src/common/TextArea/styles.tsx: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const StyledContainer = styled("div")` 4 | display: inline-block; 5 | width: 100%; 6 | padding: 10px 5px; 7 | margin-bottom: -0.625rem; 8 | `; 9 | 10 | export const StyledTextArea = styled("textarea")` 11 | resize: none; 12 | font-size: 0.875rem; 13 | height: 185px; 14 | `; 15 | 16 | export const Label = styled("label")` 17 | display: block; 18 | padding-bottom: 10px; 19 | text-transform: capitalize; 20 | `; 21 | -------------------------------------------------------------------------------- /src/common/types.ts: -------------------------------------------------------------------------------- 1 | import { TFunction } from "react-i18next"; 2 | export interface ContainerProps { 3 | border?: boolean; 4 | children: React.ReactNode; 5 | } 6 | 7 | export interface ButtonProps { 8 | color?: string; 9 | name?: string; 10 | children: React.ReactNode; 11 | onClick?: () => void; 12 | } 13 | 14 | export interface SvgIconProps { 15 | src: string; 16 | width: string; 17 | height: string; 18 | } 19 | 20 | export interface InputProps { 21 | name: string; 22 | placeholder: string; 23 | t: TFunction; 24 | type?: string; 25 | value?: string; 26 | onChange: ( 27 | event: 28 | | React.ChangeEvent 29 | | React.ChangeEvent 30 | ) => void; 31 | } 32 | export interface validateProps { 33 | name: string; 34 | message: string; 35 | email: string; 36 | } 37 | -------------------------------------------------------------------------------- /src/common/utils/useForm.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | import { notification } from "antd"; 3 | 4 | interface IValues { 5 | name: string; 6 | email: string; 7 | message: string; 8 | } 9 | 10 | const initialValues: IValues = { 11 | name: "", 12 | email: "", 13 | message: "", 14 | }; 15 | 16 | export const useForm = (validate: { (values: IValues): IValues }) => { 17 | const [formState, setFormState] = useState<{ 18 | values: IValues; 19 | errors: IValues; 20 | }>({ 21 | values: { ...initialValues }, 22 | errors: { ...initialValues }, 23 | }); 24 | 25 | const handleSubmit = async (event: React.ChangeEvent) => { 26 | event.preventDefault(); 27 | const values = formState.values; 28 | const errors = validate(values); 29 | setFormState((prevState) => ({ ...prevState, errors })); 30 | 31 | const url = ""; // Fill in your API URL here 32 | 33 | try { 34 | if (Object.values(errors).every((error) => error === "")) { 35 | const response = await fetch(url, { 36 | method: "POST", 37 | headers: { 38 | "Content-Type": "application/json", 39 | }, 40 | body: JSON.stringify(values), 41 | }); 42 | 43 | if (!response.ok) { 44 | notification["error"]({ 45 | message: "Error", 46 | description: 47 | "There was an error sending your message, please try again later.", 48 | }); 49 | } else { 50 | event.target.reset(); 51 | setFormState(() => ({ 52 | values: { ...initialValues }, 53 | errors: { ...initialValues }, 54 | })); 55 | 56 | notification["success"]({ 57 | message: "Success", 58 | description: "Your message has been sent!", 59 | }); 60 | } 61 | } 62 | } catch (error) { 63 | notification["error"]({ 64 | message: "Error", 65 | description: "Failed to submit form. Please try again later.", 66 | }); 67 | } 68 | }; 69 | 70 | const handleChange = ( 71 | event: React.ChangeEvent 72 | ) => { 73 | event.persist(); 74 | const { name, value } = event.target; 75 | setFormState((prevState) => ({ 76 | ...prevState, 77 | values: { 78 | ...prevState.values, 79 | [name]: value, 80 | }, 81 | errors: { 82 | ...prevState.errors, 83 | [name]: "", 84 | }, 85 | })); 86 | }; 87 | 88 | return { 89 | handleChange, 90 | handleSubmit, 91 | values: formState.values, 92 | errors: formState.errors, 93 | }; 94 | }; 95 | -------------------------------------------------------------------------------- /src/common/utils/validationRules.ts: -------------------------------------------------------------------------------- 1 | import { validateProps } from "../../common/types"; 2 | 3 | export default function validate(values: validateProps) { 4 | let errors = {} as validateProps; 5 | 6 | if (!values.name) { 7 | errors.name = "Name is required"; 8 | } 9 | if (!values.email) { 10 | errors.email = "Email address is required"; 11 | } else if (!/\S+@\S+\.\S+/.test(values.email)) { 12 | errors.email = "Email address is invalid"; 13 | } 14 | if (!values.message) { 15 | errors.message = "Message is required"; 16 | } 17 | return errors; 18 | } 19 | -------------------------------------------------------------------------------- /src/components/Block/index.tsx: -------------------------------------------------------------------------------- 1 | import { withTranslation, TFunction } from "react-i18next"; 2 | import { Container, TextWrapper, Content } from "./styles"; 3 | 4 | interface Props { 5 | title: string; 6 | content: string; 7 | t: TFunction; 8 | } 9 | 10 | const Block = ({ title, content, t }: Props) => { 11 | return ( 12 | 13 |
{t(title)}
14 | 15 | {t(content)} 16 | 17 |
18 | ); 19 | }; 20 | 21 | export default withTranslation()(Block); 22 | -------------------------------------------------------------------------------- /src/components/Block/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const Content = styled("p")` 4 | margin-top: 1.5rem; 5 | `; 6 | 7 | export const Container = styled("div")` 8 | position: relative; 9 | max-width: 700px; 10 | `; 11 | 12 | export const TextWrapper = styled("div")` 13 | border-radius: 3rem; 14 | max-width: 400px; 15 | `; 16 | -------------------------------------------------------------------------------- /src/components/ContactForm/index.tsx: -------------------------------------------------------------------------------- 1 | import { Row, Col } from "antd"; 2 | import { withTranslation } from "react-i18next"; 3 | import { Slide } from "react-awesome-reveal"; 4 | import { ContactProps, ValidationTypeProps } from "./types"; 5 | import { useForm } from "../../common/utils/useForm"; 6 | import validate from "../../common/utils/validationRules"; 7 | import { Button } from "../../common/Button"; 8 | import Block from "../Block"; 9 | import Input from "../../common/Input"; 10 | import TextArea from "../../common/TextArea"; 11 | import { ContactContainer, FormGroup, Span, ButtonContainer } from "./styles"; 12 | 13 | const Contact = ({ title, content, id, t }: ContactProps) => { 14 | const { values, errors, handleChange, handleSubmit } = useForm(validate); 15 | 16 | const ValidationType = ({ type }: ValidationTypeProps) => { 17 | const ErrorMessage = errors[type as keyof typeof errors]; 18 | return {ErrorMessage}; 19 | }; 20 | 21 | return ( 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 40 | 41 | 42 | 43 | 50 | 51 | 52 | 53 |