fix styles
This commit is contained in:
parent
e693462f0f
commit
7d3f76d230
@ -24,7 +24,7 @@
|
|||||||
work correctly both with client-side routing and a non-root public URL.
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
-->
|
-->
|
||||||
<title>React App</title>
|
<title>Crypto Converter</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
20
src/App.scss
20
src/App.scss
@ -2,16 +2,13 @@ body{
|
|||||||
background: #e5e5e5;
|
background: #e5e5e5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.converter {
|
.converter {
|
||||||
|
max-width: 630px;
|
||||||
max-width: 610px;
|
|
||||||
margin: 50px auto;
|
margin: 50px auto;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
|
||||||
|
|
||||||
&__head {
|
&__head {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
@ -47,11 +44,7 @@ body{
|
|||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
}
|
}
|
||||||
&_border{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
&__crypto-name {
|
&__crypto-name {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -80,7 +73,6 @@ body{
|
|||||||
width: 40px;
|
width: 40px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__arrow {
|
&__arrow {
|
||||||
@ -89,15 +81,18 @@ body{
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
background: #999;
|
background: #999;
|
||||||
-webkit-mask: url(//yastatic.net/s3/web4static/_/v2/static/media/Swap_16.c0236c02.svg) no-repeat center;
|
-webkit-mask: url(//yastatic.net/s3/web4static/_/v2/static/media/Swap_16.c0236c02.svg)
|
||||||
mask: url(//yastatic.net/s3/web4static/_/v2/static/media/Swap_16.c0236c02.svg) no-repeat center;
|
no-repeat center;
|
||||||
|
mask: url(//yastatic.net/s3/web4static/_/v2/static/media/Swap_16.c0236c02.svg)
|
||||||
|
no-repeat center;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__input {
|
&__input {
|
||||||
border: 2px solid rgba(7, 28, 71, 0.12);
|
border: 2px solid rgba(7, 28, 71, 0.12);
|
||||||
border-radius: 10px 0 0 10px;
|
border-radius: 10px 0 0 10px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-family: HelveticaNeue-Light,"Helvetica Neue Light",Helvetica,Arial,sans-serif;
|
font-family: HelveticaNeue-Light, 'Helvetica Neue Light', Helvetica, Arial,
|
||||||
|
sans-serif;
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
width: 201px;
|
width: 201px;
|
||||||
@ -109,7 +104,6 @@ body{
|
|||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
&__footer {
|
&__footer {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import React from 'react';
|
import { render, screen } from '@testing-library/react'
|
||||||
import { render, screen } from '@testing-library/react';
|
import App from './App'
|
||||||
import App from './App';
|
|
||||||
|
|
||||||
test('renders learn react link', () => {
|
test('renders learn react link', () => {
|
||||||
render(<App />);
|
render(<App />)
|
||||||
const linkElement = screen.getByText(/learn react/i);
|
const linkElement = screen.getByText(/learn react/i)
|
||||||
expect(linkElement).toBeInTheDocument();
|
expect(linkElement).toBeInTheDocument()
|
||||||
});
|
})
|
||||||
|
170
src/App.tsx
170
src/App.tsx
@ -1,15 +1,15 @@
|
|||||||
import { ChangeEvent, useEffect, useRef, useState } from 'react';
|
import { ChangeEvent, useEffect, useRef, useState } from 'react'
|
||||||
import './App.scss';
|
|
||||||
import btc from '../src/assets/images/btc.svg'
|
import btc from '../src/assets/images/btc.svg'
|
||||||
import usdt from '../src/assets/images/usdt.svg'
|
import usdt from '../src/assets/images/usdt.svg'
|
||||||
import eth from '../src/assets/images/eth.svg'
|
import eth from '../src/assets/images/eth.svg'
|
||||||
import useOnClickOutside from './hooks/useOnClickOutside';
|
import useOnClickOutside from './hooks/useOnClickOutside'
|
||||||
import { PopupConverter } from './Components/popup-converter/Popup-converter';
|
import { PopupConverter } from './Components/popup-converter/Popup-converter'
|
||||||
import { convert } from '.';
|
import { convert } from '.'
|
||||||
import { IValutions } from './models/IValutions';
|
import { IValutions } from './models/IValutions'
|
||||||
|
|
||||||
|
import './App.scss'
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
|
||||||
const valuations: IValutions[] = [
|
const valuations: IValutions[] = [
|
||||||
{
|
{
|
||||||
title: 'BTC',
|
title: 'BTC',
|
||||||
@ -25,39 +25,42 @@ function App() {
|
|||||||
title: 'ETH',
|
title: 'ETH',
|
||||||
img: eth,
|
img: eth,
|
||||||
alt: 'Ethereum'
|
alt: 'Ethereum'
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
const [firstValue, setFirstValue] = useState<string>('1')
|
const [firstValue, setFirstValue] = useState<string>('1')
|
||||||
const [secondValue, setSecondValue] = useState<string>('1')
|
const [secondValue, setSecondValue] = useState<string>('1')
|
||||||
const [firstValuation, setFirstValuation] = useState<IValutions>(valuations[0])
|
const [firstValuation, setFirstValuation] = useState<IValutions>(
|
||||||
const [secondValuation, setSecondValuation] = useState<IValutions>(valuations[1])
|
valuations[0]
|
||||||
|
)
|
||||||
|
const [secondValuation, setSecondValuation] = useState<IValutions>(
|
||||||
|
valuations[1]
|
||||||
|
)
|
||||||
const [showFirstValuation, setShowFirstValuation] = useState<boolean>()
|
const [showFirstValuation, setShowFirstValuation] = useState<boolean>()
|
||||||
const [showSecondValuation, setShowSecondValuation] = useState<boolean>()
|
const [showSecondValuation, setShowSecondValuation] = useState<boolean>()
|
||||||
const [isSwap, setSwap] = useState(true)
|
const [isSwap, setSwap] = useState(true)
|
||||||
|
|
||||||
|
|
||||||
const regexInput = (e: ChangeEvent<HTMLInputElement>) => {
|
const regexInput = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
let [_, sign, integer, decimals]: any = e.target.value
|
||||||
|
.replace(/[^\d\.\-]/g, '')
|
||||||
|
.replace(/(\..*?)\./g, '$1')
|
||||||
|
.replace(/(.+)-/g, '$1')
|
||||||
|
.match(/^(-?)(.*?)((?:\.\d*)?)$/)
|
||||||
|
|
||||||
let [_, sign, integer, decimals]: any = e.target.value.replace(/[^\d\.\-]/g, "")
|
let pos: number = Number(e.target.selectionStart) - 1
|
||||||
.replace(/(\..*?)\./g, "$1")
|
if (!integer && decimals) pos += 2
|
||||||
.replace(/(.+)-/g, "$1")
|
|
||||||
.match(/^(-?)(.*?)((?:\.\d*)?)$/);
|
|
||||||
|
|
||||||
let pos: number = Number(e.target.selectionStart) - 1;
|
|
||||||
if (!integer && decimals) pos += 2;
|
|
||||||
|
|
||||||
if (integer || decimals) {
|
if (integer || decimals) {
|
||||||
integer = +integer;
|
integer = +integer
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatted = sign + integer + decimals;
|
const formatted = sign + integer + decimals
|
||||||
|
|
||||||
if (formatted !== e.target.value) {
|
if (formatted !== e.target.value) {
|
||||||
e.target.value = formatted;
|
e.target.value = formatted
|
||||||
e.target.setSelectionRange(pos, pos);
|
e.target.setSelectionRange(pos, pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,12 +82,15 @@ function App() {
|
|||||||
|
|
||||||
const getSecondValuation = async (value: number) => {
|
const getSecondValuation = async (value: number) => {
|
||||||
await convert.ready()
|
await convert.ready()
|
||||||
setSecondValue(convert[firstValuation.title][secondValuation.title](value) || 0)
|
setSecondValue(
|
||||||
|
convert[firstValuation.title][secondValuation.title](value) || 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const getFirstValuation = async (value: number) => {
|
const getFirstValuation = async (value: number) => {
|
||||||
await convert.ready()
|
await convert.ready()
|
||||||
setFirstValue(convert[secondValuation.title][firstValuation.title](value) || 0)
|
setFirstValue(
|
||||||
|
convert[secondValuation.title][firstValuation.title](value) || 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const swap = () => {
|
const swap = () => {
|
||||||
@ -96,7 +102,7 @@ function App() {
|
|||||||
useOnClickOutside(ref, () => {
|
useOnClickOutside(ref, () => {
|
||||||
setShowSecondValuation(false)
|
setShowSecondValuation(false)
|
||||||
setShowFirstValuation(false)
|
setShowFirstValuation(false)
|
||||||
});
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getSecondValuation(+firstValue)
|
getSecondValuation(+firstValue)
|
||||||
@ -117,79 +123,115 @@ function App() {
|
|||||||
return () => clearInterval(interval)
|
return () => clearInterval(interval)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
const getValuations = () =>
|
||||||
|
`${firstValue || 0} ${firstValuation.title} = ${secondValue || 0} ${
|
||||||
|
secondValuation.title
|
||||||
|
}`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="converter">
|
<div className='converter'>
|
||||||
<div className="converter__body">
|
<div className='converter__body'>
|
||||||
<div className="converter__row converter__row_border">
|
<div className='converter__row converter__row_border'>
|
||||||
<input className='converter__input' type="text" value={firstValue}
|
<input
|
||||||
onChange={handlerInputOne} />
|
className='converter__input'
|
||||||
<span className='converter__crypto-name' onClick={openFirstListValuation}>
|
type='text'
|
||||||
|
value={firstValue}
|
||||||
|
onChange={handlerInputOne}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className='converter__crypto-name'
|
||||||
|
onClick={openFirstListValuation}
|
||||||
|
>
|
||||||
<div className={'converter__crypto-name-title'}>
|
<div className={'converter__crypto-name-title'}>
|
||||||
<img src={firstValuation.img} alt="" />
|
<img src={firstValuation.img} alt='' />
|
||||||
{firstValuation.title}
|
{firstValuation.title}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<svg focusable="false" xmlns="http://www.w3.org/2000/svg" width="8" height="14"><path
|
<svg
|
||||||
d="M4 0l4 6H0l4-6zm0 14l4-6H0l4 6z" /></svg>
|
focusable='false'
|
||||||
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
|
width='8'
|
||||||
|
height='14'
|
||||||
|
>
|
||||||
|
<path d='M4 0l4 6H0l4-6zm0 14l4-6H0l4 6z' />
|
||||||
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
{showFirstValuation && <div className='converter__popup popup-converter' ref={ref}>
|
{showFirstValuation && (
|
||||||
{valuations.map((item, index) =>
|
<div className='converter__popup popup-converter' ref={ref}>
|
||||||
|
{valuations.map((item, index) => (
|
||||||
<PopupConverter
|
<PopupConverter
|
||||||
key={index}
|
key={index}
|
||||||
item={item}
|
item={item}
|
||||||
setValuation={setFirstValuation}
|
setValuation={setFirstValuation}
|
||||||
valuation={firstValuation.title}
|
valuation={firstValuation.title}
|
||||||
|
/>
|
||||||
/>)}
|
))}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="converter__row">
|
<div className='converter__row'>
|
||||||
<div className={'converter__arrow'} onClick={swap} />
|
<div className={'converter__arrow'} onClick={swap} />
|
||||||
</div>
|
</div>
|
||||||
<div className="converter__row converter__row_border">
|
<div className='converter__row converter__row_border'>
|
||||||
<input className='converter__input' min={0} type="text" maxLength={20} value={secondValue}
|
<input
|
||||||
onChange={handlerInputTwo} />
|
className='converter__input'
|
||||||
<span className='converter__crypto-name' onClick={openSecondListValuation}>
|
min={0}
|
||||||
|
type='text'
|
||||||
|
maxLength={20}
|
||||||
|
value={secondValue}
|
||||||
|
onChange={handlerInputTwo}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className='converter__crypto-name'
|
||||||
|
onClick={openSecondListValuation}
|
||||||
|
>
|
||||||
<div className={'converter__crypto-name-title'}>
|
<div className={'converter__crypto-name-title'}>
|
||||||
<img src={secondValuation.img} alt="" />
|
<img src={secondValuation.img} alt='' />
|
||||||
{secondValuation.title}
|
{secondValuation.title}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<svg focusable="false" xmlns="http://www.w3.org/2000/svg" width="8" height="14"><path
|
<svg
|
||||||
d="M4 0l4 6H0l4-6zm0 14l4-6H0l4 6z" /></svg>
|
focusable='false'
|
||||||
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
|
width='8'
|
||||||
|
height='14'
|
||||||
|
>
|
||||||
|
<path d='M4 0l4 6H0l4-6zm0 14l4-6H0l4 6z' />
|
||||||
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
{showSecondValuation && <div className='converter__popup popup-converter' ref={ref}>
|
{showSecondValuation && (
|
||||||
{valuations.map((item, index) =>
|
<div className='converter__popup popup-converter' ref={ref}>
|
||||||
|
{valuations.map((item, index) => (
|
||||||
<PopupConverter
|
<PopupConverter
|
||||||
key={index}
|
key={index}
|
||||||
item={item}
|
item={item}
|
||||||
valuation={secondValuation.title}
|
valuation={secondValuation.title}
|
||||||
setValuation={setSecondValuation}
|
setValuation={setSecondValuation}
|
||||||
/>)}
|
/>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer className="converter__footer">
|
<footer className='converter__footer'>
|
||||||
<b>{(firstValue || 0) + ' ' + firstValuation.title + ' = ' + (secondValue || 0) + ' ' + secondValuation.title}</b>
|
<b>{getValuations()}</b>
|
||||||
<br />
|
<br />
|
||||||
Данные носят ознакомительный характер {'\t'}
|
Данные носят ознакомительный характер {'\t'}
|
||||||
<b>
|
<b>
|
||||||
{
|
{new Date(convert.lastUpdated).toLocaleDateString() +
|
||||||
new Date(convert.lastUpdated).toLocaleDateString() + ' ' +
|
' ' +
|
||||||
new Date(convert.lastUpdated).getHours() + ':' +
|
new Date(convert.lastUpdated).getHours() +
|
||||||
new Date(convert.lastUpdated).getMinutes().toString().padStart(2, '0')
|
':' +
|
||||||
}
|
new Date(convert.lastUpdated)
|
||||||
|
.getMinutes()
|
||||||
|
.toString()
|
||||||
|
.padStart(2, '0')}
|
||||||
</b>
|
</b>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App;
|
export default App
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
z-index: 2;
|
z-index: 2;
|
||||||
inset: 75px auto auto 0;
|
inset: 75px auto auto 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-shadow: 0 4px 24px rgba(0,0,0,.25);
|
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
|
||||||
background: #fff;
|
background: #fff;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -48,7 +48,7 @@
|
|||||||
margin: 0 4px;
|
margin: 0 4px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
color: rgba(84,96,122,.68);
|
color: rgba(84, 96, 122, 0.68);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,16 +1,12 @@
|
|||||||
import {Dispatch, FC, MouseEvent} from "react"
|
import { FC, MouseEvent } from 'react'
|
||||||
import {IListValuationsName} from "../../models/IListValutionsName"
|
import { IListValuationsName } from '../../models/IListValutionsName'
|
||||||
import './Popup-converter.scss'
|
import './Popup-converter.scss'
|
||||||
|
|
||||||
|
export const PopupConverter: FC<IListValuationsName> = ({
|
||||||
export const PopupConverter: FC<IListValuationsName> = (
|
|
||||||
{
|
|
||||||
item,
|
item,
|
||||||
valuation,
|
valuation,
|
||||||
setValuation,
|
setValuation
|
||||||
}
|
}) => {
|
||||||
) => {
|
|
||||||
|
|
||||||
const setActiveValuation = (e: MouseEvent<HTMLDivElement>) => {
|
const setActiveValuation = (e: MouseEvent<HTMLDivElement>) => {
|
||||||
setValuation({
|
setValuation({
|
||||||
img: item.img,
|
img: item.img,
|
||||||
@ -21,22 +17,27 @@ export const PopupConverter: FC<IListValuationsName> = (
|
|||||||
return (
|
return (
|
||||||
<div className={'popup-converter__container'} onClick={setActiveValuation}>
|
<div className={'popup-converter__container'} onClick={setActiveValuation}>
|
||||||
<div className={'popup-converter__check'}>
|
<div className={'popup-converter__check'}>
|
||||||
{valuation === item.title &&
|
{valuation === item.title && (
|
||||||
<svg focusable="false" xmlns="http://www.w3.org/2000/svg" width="16" height="10">
|
<svg
|
||||||
<path d="M7.207 7.506L3.629 3.81 2.343 4.939l4.841 5.002 8.462-8.428L14.382.362z"/>
|
focusable='false'
|
||||||
</svg>}
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
|
width='16'
|
||||||
|
height='10'
|
||||||
|
>
|
||||||
|
<path d='M7.207 7.506L3.629 3.81 2.343 4.939l4.841 5.002 8.462-8.428L14.382.362z' />
|
||||||
|
</svg>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={'popup-converter__body'}>
|
<div className={'popup-converter__body'}>
|
||||||
<img className={'popup-converter__img'} src={item.img} alt="icon"/>
|
<img className={'popup-converter__img'} src={item.img} alt='icon' />
|
||||||
<button type='button'
|
<button
|
||||||
|
type='button'
|
||||||
className={'popup-converter__button'}
|
className={'popup-converter__button'}
|
||||||
value={item.title}
|
value={item.title}
|
||||||
>{item.title} <span>{item.alt}</span></button>
|
>
|
||||||
|
{item.title} <span>{item.alt}</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
|
export default function useOnClickOutside(
|
||||||
export default function useOnClickOutside(ref:React.RefObject<any>, handler:Function) {
|
ref: React.RefObject<any>,
|
||||||
useEffect(
|
handler: Function
|
||||||
() => {
|
) {
|
||||||
|
useEffect(() => {
|
||||||
const listener = (event: MouseEvent | TouchEvent) => {
|
const listener = (event: MouseEvent | TouchEvent) => {
|
||||||
if (!ref.current || ref.current.contains(event.target)) {
|
if (!ref.current || ref.current.contains(event.target)) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
handler(event);
|
handler(event)
|
||||||
};
|
}
|
||||||
document.addEventListener("mousedown", listener);
|
document.addEventListener('mousedown', listener)
|
||||||
document.addEventListener("touchstart", listener);
|
document.addEventListener('touchstart', listener)
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener("mousedown", listener);
|
document.removeEventListener('mousedown', listener)
|
||||||
document.removeEventListener("touchstart", listener);
|
document.removeEventListener('touchstart', listener)
|
||||||
};
|
}
|
||||||
},
|
}, [ref, handler])
|
||||||
[ref, handler]
|
|
||||||
);
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import axios from "axios"
|
import axios from 'axios'
|
||||||
|
|
||||||
export const API_URL = 'https://testnet.binancefuture.com'
|
export const API_URL = 'https://testnet.binancefuture.com'
|
||||||
|
|
||||||
|
@ -1,34 +1,31 @@
|
|||||||
import React from 'react';
|
import ReactDOM from 'react-dom/client'
|
||||||
import ReactDOM from 'react-dom/client';
|
import './index.css'
|
||||||
import './index.css';
|
import App from './App'
|
||||||
import App from './App';
|
import reportWebVitals from './reportWebVitals'
|
||||||
import reportWebVitals from './reportWebVitals';
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||||
import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
|
|
||||||
|
|
||||||
const CryptoConvert = require("crypto-convert").default;
|
const CryptoConvert = require('crypto-convert').default
|
||||||
|
|
||||||
export const convert = new CryptoConvert({
|
export const convert = new CryptoConvert({
|
||||||
cryptoInterval: 20000, //Crypto prices update interval in ms (default 5 seconds on Node.js & 15 seconds on Browsers)
|
cryptoInterval: 20000, //Crypto prices update interval in ms (default 5 seconds on Node.js & 15 seconds on Browsers)
|
||||||
fiatInterval: (60 * 1e3 * 60), //Fiat prices update interval (default every 1 hour)
|
fiatInterval: 60 * 1e3 * 60, //Fiat prices update interval (default every 1 hour)
|
||||||
calculateAverage: true, //Calculate the average crypto price from exchanges
|
calculateAverage: true, //Calculate the average crypto price from exchanges
|
||||||
binance: true, //Use binance rates
|
binance: true, //Use binance rates
|
||||||
bitfinex: true, //Use bitfinex rates
|
bitfinex: true, //Use bitfinex rates
|
||||||
coinbase: true, //Use coinbase rates
|
coinbase: true, //Use coinbase rates
|
||||||
kraken: true, //Use kraken rates
|
kraken: true, //Use kraken rates
|
||||||
HTTPAgent: null //HTTP Agent for server-side proxies (Node.js only)
|
HTTPAgent: null //HTTP Agent for server-side proxies (Node.js only)
|
||||||
});
|
})
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(
|
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
|
||||||
document.getElementById('root') as HTMLElement
|
|
||||||
);
|
|
||||||
const queryClient = new QueryClient()
|
const queryClient = new QueryClient()
|
||||||
root.render(
|
root.render(
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<App />
|
<App />
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
);
|
)
|
||||||
|
|
||||||
// If you want to start measuring performance in your app, pass a function
|
// If you want to start measuring performance in your app, pass a function
|
||||||
// to log results (for example: reportWebVitals(console.log))
|
// to log results (for example: reportWebVitals(console.log))
|
||||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||||
reportWebVitals();
|
reportWebVitals()
|
||||||
|
@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
|
Before Width: | Height: | Size: 2.6 KiB |
@ -1,8 +1,8 @@
|
|||||||
import { Dispatch } from "react";
|
import { Dispatch } from 'react'
|
||||||
import { IValutions } from "./IValutions";
|
import { IValutions } from './IValutions'
|
||||||
|
|
||||||
export interface IListValuationsName {
|
export interface IListValuationsName {
|
||||||
item: IValutions,
|
item: IValutions
|
||||||
setValuation: Dispatch<IValutions>,
|
setValuation: Dispatch<IValutions>
|
||||||
valuation: string
|
valuation: string
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
export interface IValutions {
|
export interface IValutions {
|
||||||
title: string,
|
title: string
|
||||||
img: string,
|
img: string
|
||||||
alt?: string
|
alt?: string
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { ReportHandler } from 'web-vitals';
|
import { ReportHandler } from 'web-vitals'
|
||||||
|
|
||||||
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||||
getCLS(onPerfEntry);
|
getCLS(onPerfEntry)
|
||||||
getFID(onPerfEntry);
|
getFID(onPerfEntry)
|
||||||
getFCP(onPerfEntry);
|
getFCP(onPerfEntry)
|
||||||
getLCP(onPerfEntry);
|
getLCP(onPerfEntry)
|
||||||
getTTFB(onPerfEntry);
|
getTTFB(onPerfEntry)
|
||||||
});
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
export default reportWebVitals;
|
export default reportWebVitals
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
// allows you to do things like:
|
// allows you to do things like:
|
||||||
// expect(element).toHaveTextContent(/react/i)
|
// expect(element).toHaveTextContent(/react/i)
|
||||||
// learn more: https://github.com/testing-library/jest-dom
|
// learn more: https://github.com/testing-library/jest-dom
|
||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom'
|
||||||
|
Loading…
Reference in New Issue
Block a user