Giter VIP home page Giter VIP logo

age-calculator-app-main's Introduction

Group 48095678

Age Calculator

The Age Calculator is a simple web application that calculates a person's age based on their birth date. Users can input their birth date, and the app will display their age in year! s, months, and days.

Technologies Used

This project was built using the following technologies:

  1. React - A popular JavaScript library for building user interfaces.
  2. Vite - A build tool and development server for web applications, used for faster development and optimized production builds.
  3. Sass - A preprocessor scripting language that extends CSS, allowing for more advanced features and better code organization.
  4. GitHub Pages - A platform for hosting static websites directly from GitHub repositories.

The site is live at https://marktim24.github.io/age-calculator-app-main/

React Components and Functions

The Age Calculator application consists of several React components, as well as custom hooks for handling form input and validation:

  • InputForm: A reusable component for rendering form inputs with labels and error messages.
  • AgeForm: A component that uses the InputForm component to create a form for entering the user's birth date (day, month, and year).
  • CalculateButton: A component for rendering a button to calculate the user's age.
  • OutputForm: A component for displaying the calculated age in years, months, and days.
  • AgeCalculator: The main component that combines all other components and manages the state and logic of the application.
  • useAgeCalculator: A custom hook that handles form input, validation, and age calculation.

Features

  • useState hook: The Age Calculator App utilizes React's useState hook to manage component state, allowing the app to respond to user input and update the user interface accordingly.

  • Custom hook: The app implements a custom hook, useAgeCalculator.js, which encapsulates the age calculation logic and state management. This custom hook makes the code more modular and easier to maintain.

  • Responsive design: The app's layout and styling are optimized for various screen sizes using media queries in SCSS. This ensures a consistent and user-friendly experience across different devices.

  • Form validation: The app includes input validation to ensure that users provide valid date values for their date of birth. Error messages are displayed to guide users in correcting any input mistakes.

  • SCSS structure: The SCSS files are organized in a modular fashion, with separate files for variables and each component. This structure allows for better maintainability and ease of customization.

  • Vite: The project uses Vite as the build tool and development server, providing a fast and efficient development experience.

Project Setup and Development

To set up the project locally and start the development server, follow these steps:

  1. Clone the repository:

    git clone https://github.com/<username>/<repository>.git
    cd <repository>
    
    Install the dependencies:

bash Copy code npm install Start the development server:

bash Copy code npm run dev This will open the application in your default web browser at http://localhost:3000.

Building and Deploying to GitHub Pages To build the project for production and deploy it to GitHub Pages, follow these steps:

Build the project for production:

bash Copy code npm run build This will generate the production build in the dist folder.

Deploy the build to GitHub Pages:

bash Copy code npm run deploy This command will push the contents of the dist folder to the gh-pages branch of your repository.

age-calculator-app-main's People

Contributors

marktim24 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.