-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OV-6: Loader component #14
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use layout components for ui lib - https://v2.chakra-ui.com/docs/components/box
you can avoid some custom styles
export { Loader } from './loader/loader.js'; | ||
export { LoaderOverlay } from './loader-overlay/loader-overlay.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please unite these 2 components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or pass Loader through props as children and leave it as Overlay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can export both of them but there is no point in just importing Loader in LoaderOverlay component
Make it accept any component as children
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've just done this.
frontend/src/bundles/common/components/loader/libs/constants/spin-animation.constant.ts
Show resolved
Hide resolved
@@ -0,0 +1,35 @@ | |||
import { Box, Circle, Flex, keyframes, Text } from '@chakra-ui/react'; | |||
|
|||
const spin = keyframes` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./contstants/spin-animation.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, you should add some transitions to overlay - https://v2.chakra-ui.com/docs/components/transitions
because it will cover all screen
frontend/src/bundles/common/components/loader/libs/constants/spin-animation.constant.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export Loader component as well
@@ -0,0 +1,8 @@ | |||
import { keyframes } from '@chakra-ui/react'; | |||
|
|||
const spin = keyframes` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const spin = keyframes` | |
const SPIN_ANIMATION = keyframes` |
|
||
const LoaderOverlay = (): JSX.Element => { | ||
return ( | ||
<Fade in={true}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does transition work if you hide overlay from the parent component?
animation={`${SPIN_ANIMATION} 1s linear infinite`} | ||
></Circle> | ||
</Box> | ||
<Text fontSize="lg" marginTop="10px"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should use the shortcuts that chakra ui is providing us with (e.g. alignItems -> align, marginTop -> mt)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like shortcasts because they are hard to read
This PR adds Loader and LoaderOverlay components.

