Skip to content

Currency converter πŸ’΅ with draggable multiple currencies πŸ’₯, using Redux state management.

Notifications You must be signed in to change notification settings

daniknewgarden/react-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Currency converter

Hi! This is the most cozy converter ever 😊.

Video
See demo

Here you can read how to run it, and how to use all components. Lets start πŸ‘‡

This project was bootstrapped with Create React App.

How to run? πŸƒβ€β™‚οΈ

Ready, set, go!🀣
Seriously, in the project directory, you can run:

npm start

Runs the app in the development mode. πŸ› 
Open http://localhost:3000 to view it in the browser.

npm test

Launches the test runner in the interactive watch mode. πŸ§ͺ
But right now this feature isn't available. 🌚

npm build

Builds the app for production to the build folder. πŸ—
It correctly bundles React in production mode and optimizes the build for the best performance.

Project structure 🌲


Generated by markdown-tree

Components guide 🧩

ControlBtn

Screenshot
Button allows you to toggle change something.

Props Type Description
label string Text in button.
onClick function Callback function.
icon string Way to your icon.
reversed boolean Change padding side (default side: left).
big boolean Change font size to more bigger.
active boolean If you need to has focus button state.

AddBtn

Screenshot
Button allows you to call something on click.

Props Type Description
onClick function Callback function.

Dropdown

Screenshot
Allows you to choose some option.

Props Type Description
list array Array of options to select.
defaultOptionIndex number Selected option be default.
onChoose function Function receiving selected element.

Currency

Screenshot
Currency card.

Props Type Description
canRemove boolean Can it be deleted?
remove function Function for card removing (on click remove button).
baseStatus boolean Only one currency can be base.

Convert algorithm. πŸ‘¨β€πŸ”¬

Algorithm

Header

Screenshot
Header of the App. Here you can change screen mode and theme

Column

Screenshot
Column contains currencies, you can add and remove them.

Columns variants

Name Type Description
BaseColumn base Contains only one currency (base)
Column normal Contains normal currencies. You add and remove them.

BaseColumn props

Props Type Description
fullscreen boolean If fullscreen enabled, it has some styles.

Scrollbar

Screenshot
I used pretty custom scrollbar.

See react-custom-scrollbars docs

Hooks guide βš“

useClickOutside πŸ‘†

Allows you to tracks clicks outside the item to do something.

Argument Type Description
ref useRef() React link for your item.
callback function Callback function.

Example

import React, { useRef } from "react";
import { useClickOutside } from "way to useClickOutside";

//Component
export const Dropdown = () => {
 const [opened, setOpened] = useState(false);

 const toggleOpened = () => {
  setOpened(!opened)
 }

 //Click outside track
 const menuRef = useRef();
 useClickOutside(menuRef, toggleOpened);

 return(
  <button>{opened ? 'Close' : 'Open'} menu </button>
  {opened && <div ref={menuRef}>Menu</div>}
 )
}

State management guide πŸ‘©β€πŸ’Ό

I'm using Redux to manage global state. See official redux and react-redux docs.

States description

Theme 🎨

Allows you to toggle change the theme.

Action Argument Description
applyTheme boolean Enable or disable dark theme.

Fullscreen πŸ’»

Allows you to toggle change the fullscreen mode.

Action Argument Description
applyFullscreen boolean Enable or disable fullscreen.

Column mode πŸ“³

Works only on phone πŸ“±.
Two column demo

Action Argument Description
applyTwoColumn boolean Enable or disable two column mode.

Base value πŸ’±

The base currency value is basic for conversion to other currencies. It calls in all currencies. See algorithm docs.

Action Argument Description
updateBaseValue number Update base currency value.

API requests

I'm using redux-thunk for async API requests.

Action Argument Description
fetchRates string Base currency short name (USD, EUR)

About

Currency converter πŸ’΅ with draggable multiple currencies πŸ’₯, using Redux state management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published