Giter Club home page Giter Club logo

clocks's Introduction

Clocks

Made with HTML, CSS, TypeScript, ReactJS, CSS Modules
Bootstrapped with Vite

GitHub Workflow Status GitHub last commit GitHub

πŸ–Ό Screenshots β€’ ℹ️ About β€’ βš™οΈ Tools β€’ πŸ”¨ How to Build Project β€’ πŸ“ File Structure

πŸ“¦ NPM Packages worth mentioning β€’ πŸ’‘ Details β€’ πŸ”— Useful resources β€’ πŸ‘€ Author

πŸ–Ό Screenshots

ℹ️ About

I was fascinated by this codepen: https://codepen.io/jkantner/pen/GRQaPPV.

The challenge is to replicate the logic of this codepen, but using React. Another task was to add several new features and practice with Materal UI.

I made my own Figma prototype and redesigned the whole application.

Figma prototype: https://www.figma.com/file/smtaFQVSv1tBtsiMHWzksy/Time-Now?type=design&node-id=0%3A1&t=w0rQeWcpLc5UCJK0-1

βš™οΈ Tools

  • HTML5
    • ReactJS
  • CSS
    • CSS Modules
  • TypeScript
    • ReactJS
  • Github Pages

πŸ”¨ Build project

Command Description
npmΒ install First of all install all required packages
npmΒ runΒ dev Run the app in development mode
npmΒ runΒ build Build the app
npmΒ runΒ preview Run the app in production mode
npmΒ runΒ lint Check compliance with Eslint rules

πŸ“ File Structure

β”œβ”€β”€ πŸ“ .github
|   β”œβ”€β”€ πŸ“ workflows
|   |   └── πŸ“ main.yaml      CI/CD instructions for Github Actions
β”‚   └── πŸ“ dependabot.yml     Instructions for Dependabot
|
β”œβ”€β”€ πŸ“ docs                   Additional information, documentation
β”‚   └── πŸ“ results            Screenshots of how the application works after being fully developed
|
β”œβ”€β”€ πŸ“ src                    Source files needed for application development
β”‚   β”œβ”€β”€ πŸ“ assets             Static assets: images, icons, favicons
β”‚   β”œβ”€β”€ πŸ“ components         React components
|   |   └── πŸ“ ComponentName
|   |       β”œβ”€β”€ πŸ“ index.tsx          Component logic
|   |       β”œβ”€β”€ πŸ“ index.module.css   Component styles
|   |       └── πŸ“ index.types.tsx    Component types (optional)
β”‚   β”œβ”€β”€ πŸ“ App.tsx            App React component
β”‚   β”œβ”€β”€ πŸ“ App.module.scss    App styles (optional)
β”‚   β”œβ”€β”€ πŸ“ index.css          Global styles
β”‚   β”œβ”€β”€ πŸ“ index.tsx          Entry point for the module bundler
β”‚   β”œβ”€β”€ πŸ“ index.html             Main html file
β”‚   └── πŸ“ vite-end.d.ts          Some Typescript stuff for Vite
|
β”œβ”€β”€ πŸ“ .eslintrc.cjs          ESLint configuration file
β”œβ”€β”€ πŸ“ .gitignore             Instructions for Git about what files to ignore
β”œβ”€β”€ πŸ“ LICENSE                MIT License. Basically you can do whatever you want with the code
β”œβ”€β”€ πŸ“ README.md              Project description
β”œβ”€β”€ πŸ“ package-lock.json      Keeps track of the exact version of every package that is installed
β”œβ”€β”€ πŸ“ package.json           Various metadata relevant to the project, scripts, dependencies
β”œβ”€β”€ πŸ“ tsconfig.json          TypeScript configuration file
β”œβ”€β”€ πŸ“ tsconfig.node.json     TypeScript configuration file for Vite
└── πŸ“ vite.config.js         Vite configuration file

πŸ“¦ NPM Packages worth mentioning

clsx For conditional lists of CSS classes
mui packages Popular component library
query-string,
react-dom,
react-router-dom
For manipulations with query strings

πŸ’‘ Details

It was the first time when I used Material UI components. They make many things extremely simple. Here are the use cases of using this library:

  • Icon buttons. For top right menu
  • Modal. For the settings modal window
  • Button. Is used in the settings modal window
  • Switch. Is also used in the settings modal window
  • Autocomplete. Likewise
  • Toggle Button Group. Likewise

As far as I know MUI, in theory, may help to completely get rid of CSS and rely only on their components. I decided not to do that and use MUI components only in those places where I found them the most valuable, where they saved much time.

For simpler tasks I relied on CSS.

I love the simplicy of CSS Modules. This feature is built in Vite, no need to configure it. And it's extremely easy to use. It with clsx eliminates any need in usin BEM or Styled Components. I absolutely love it.

The main challenge of this task was to make those digits move from top to bottom in a nicely synchronized manner. Spent many hours trying out different ways to reach that goal. What helped is just using a delayed value.

Here how it looks. There is a block. Inside of that block is a flex container with a top and bottom digit group. You animate this flex container on every change of seconds, minutes, or hours (depends on the group).

In the bottom digit group you show a real value. In the top digit group you show a delayed value. It appeared in the end to be nice and easy.

Also this project allowed me to experiment again with custom hooks. I think they enhanced code readability, very glad about that.

Another little achievement is experimenting with vmin for sizes. This CSS feature allowed to make the design look great on any screen.

Also I actively used ChatGPT for simple tasks. It still can't gracefully handle complex tasks (or probably I'm just bad at providing correct props), but overall it's a nice addition to StackOverflow!

πŸ”— Useful resources

πŸ‘€ Author

clocks's People

Contributors

arlagonix avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  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.