convert loading-screen component

This commit is contained in:
Ramón Souza 2021-10-28 17:58:04 +00:00
parent 7283bba818
commit 3ca5752c9f
3 changed files with 88 additions and 9 deletions

View File

@ -1,17 +1,20 @@
import React from 'react'; import React from 'react';
import { styles } from './styles.scss'; import Styled from './styles';
import Settings from '/imports/ui/services/settings';
const { animations } = Settings.application;
const LoadingScreen = ({ children }) => ( const LoadingScreen = ({ children }) => (
<div className={styles.background}> <Styled.Background>
<div className={styles.spinner}> <Styled.Spinner animations={animations}>
<div className={styles.bounce1} /> <Styled.Bounce1 animations={animations} />
<div className={styles.bounce2} /> <Styled.Bounce2 animations={animations} />
<div /> <div />
</div> </Styled.Spinner>
<div className={styles.message}> <Styled.Message>
{children} {children}
</div> </Styled.Message>
</div> </Styled.Background>
); );
export default LoadingScreen; export default LoadingScreen;

View File

@ -0,0 +1,72 @@
import styled, { css, keyframes } from 'styled-components';
import { mdPaddingX } from '/imports/ui/stylesheets/styled-components/general';
import { loaderBg, loaderBullet, colorWhite } from '/imports/ui/stylesheets/styled-components/palette';
import { fontSizeLarge } from '/imports/ui/stylesheets/styled-components/typography';
const Background = styled.div`
position: fixed;
display: flex;
flex-flow: column;
justify-content: center;
width: 100%;
height: 100%;
background-color: ${loaderBg};
z-index: 4;
`;
const skBouncedelay = keyframes`
0%,
80%,
100% {
transform: scale(0);
}
40% {
transform: scale(1.0);
}
`;
const Spinner = styled.div`
width: 100%;
text-align: center;
height: 22px;
margin-bottom: ${mdPaddingX};
& > div {
width: 18px;
height: 18px;
margin: 0 5px;
background-color: ${loaderBullet};
border-radius: 100%;
display: inline-block;
${({ animations }) => animations && css`
animation: ${skBouncedelay} 1.4s infinite ease-in-out both;
`}
}
`;
const Bounce1 = styled.div`
${({ animations }) => animations && `
animation-delay: -0.32s !important;
`}
`;
const Bounce2 = styled.div`
${({ animations }) => animations && `
animation-delay: -0.16s !important;
`}
`;
const Message = styled.div`
font-size: ${fontSizeLarge};
color: ${colorWhite};
text-align: center;
`;
export default {
Background,
Spinner,
Bounce1,
Bounce2,
Message,
};

View File

@ -32,6 +32,8 @@ const btnPrimaryBorder = colorPrimary;
const toolbarButtonColor = btnDefaultColor; const toolbarButtonColor = btnDefaultColor;
const userThumbnailBorder = colorGrayLight; const userThumbnailBorder = colorGrayLight;
const loaderBg = colorGrayDark;
const loaderBullet = colorWhite;
export { export {
colorWhite, colorWhite,
@ -60,4 +62,6 @@ export {
btnPrimaryBorder, btnPrimaryBorder,
toolbarButtonColor, toolbarButtonColor,
userThumbnailBorder, userThumbnailBorder,
loaderBg,
loaderBullet,
}; };