-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(infrastructure): removes cra boilerplate, introduces Vite (#15)
Co-authored-by: Asman Umbetov <[email protected]>
- Loading branch information
Showing
58 changed files
with
1,081 additions
and
6,409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { ReactNode, useCallback, useEffect } from 'react' | ||
import CloseModalSvg from 'assets/closeModal.svg' | ||
import { animated, useSpring, useTransition } from '@react-spring/web' | ||
import classNames from 'classnames' | ||
|
||
type Props = { | ||
isVisible: boolean | ||
children: ReactNode | ||
title?: string | ||
className?: string | ||
onClose?(): void | ||
} | ||
|
||
export default function Modal({ className, isVisible, children, title, onClose }: Props) { | ||
const overlayTransition = useTransition(isVisible ? true : [], { | ||
from: { opacity: 0 }, | ||
enter: { opacity: 1 }, | ||
leave: { opacity: 0 }, | ||
}) | ||
|
||
const modalTransition = useTransition(isVisible, { | ||
from: { opacity: 0, y: -30 }, | ||
enter: { opacity: 1, y: 0 }, | ||
leave: { opacity: 0 }, | ||
config: { | ||
tension: 310, | ||
friction: 20, | ||
mass: 2, | ||
}, | ||
}) | ||
|
||
return overlayTransition((modalOverlaySpring) => ( | ||
<animated.div | ||
style={{ | ||
...modalOverlaySpring, | ||
}} | ||
className={classNames( | ||
'fixed top-0 left-0 w-screen h-screen flex justify-center items-center' | ||
)} | ||
> | ||
{modalTransition((springs) => ( | ||
<animated.div | ||
className={classNames('absolute bg-white z-50 rounded-3xl p-6 shadow-modal', className)} | ||
style={{ | ||
...springs, | ||
}} | ||
> | ||
<div className='w-full h-11 flex justify-between'> | ||
<h3 className='font-normal text-2xl'>{title || ''}</h3> | ||
{onClose && <CloseModalSvg onClick={onClose} className='cursor-pointer' />} | ||
</div> | ||
{children} | ||
</animated.div> | ||
))} | ||
|
||
<animated.div className='fixed top-0 left-0 opacity-70 w-screen h-screen bg-modal-grey z-40 ' /> | ||
</animated.div> | ||
)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import IconButton from 'components/IconButton' | ||
import React, { useCallback } from 'react' | ||
import HomeIcon from 'assets/home.svg' | ||
import HomeHoverIcon from 'assets/homeHover.svg' | ||
import LinkIcon from 'assets/copyLink.svg' | ||
import LinkHoverIcon from 'assets/copyLinkHover.svg' | ||
import SettingsIcon from 'assets/settings.svg' | ||
import SettingsHoverIcon from 'assets/settingsHover.svg' | ||
import { Link } from 'react-router-dom' | ||
import { useNotifications } from 'hooks/useNotifications' | ||
|
||
export default function Sidebar() { | ||
const { addNotification } = useNotifications() | ||
const copyToClipboard = useCallback(() => { | ||
navigator.clipboard.writeText(window.location.href) | ||
addNotification({ type: 'success', text: 'Link has been successfuly copied' }) | ||
}, [addNotification]) | ||
|
||
const areSettingsImplemented = false | ||
|
||
return ( | ||
<div className='fixed top-0 left-0 z-50 h-screen w-20 inset-0 bg-primary-idle overflow-hidden'> | ||
<div className='mt-20 w-full flex flex-col items-center'> | ||
<Link to='/'> | ||
<IconButton icon={<HomeIcon />} hoverIcon={<HomeHoverIcon />} label='home' /> | ||
</Link> | ||
{areSettingsImplemented && ( | ||
<IconButton | ||
icon={<SettingsIcon />} | ||
hoverIcon={<SettingsHoverIcon />} | ||
className='mt-3.5' | ||
label='settings' | ||
/> | ||
)} | ||
<IconButton | ||
icon={<LinkIcon />} | ||
onClick={copyToClipboard} | ||
hoverIcon={<LinkHoverIcon />} | ||
className='mt-3.5' | ||
label='copy link' | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
declare module '*.svg' { | ||
const content: React.FunctionComponent<React.SVGAttributes<SVGElement>> | ||
export default content | ||
} | ||
|
||
/// <reference types="vite/client" /> | ||
/// <reference types="vite/client" /> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.