Skip to content

Commit

Permalink
Web: Files: fix upload panel loading button
Browse files Browse the repository at this point in the history
  • Loading branch information
vafomin committed Nov 11, 2021
1 parent 3a03d65 commit 80d6b80
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useState } from "react";
import styled, { css, keyframes } from "styled-components";
import globalColors from "@appserver/components/utils/globalColors";

Expand Down Expand Up @@ -32,7 +32,7 @@ const StyledCircle = styled.div`
}
${(props) =>
props.percent === 0
props.percent === 0 || (props.isAnimation && props.inConversion)
? css`
.circle__fill {
animation: ${rotate360} 2s linear infinite;
Expand Down Expand Up @@ -86,6 +86,13 @@ const StyledLoadingButton = styled.div`

const LoadingButton = ({ id, className, style, ...rest }) => {
const { percent, onClick, isConversion, inConversion } = rest;
const [isAnimation, setIsAnimation] = useState(true);

const stopAnimation = () => {
setIsAnimation(false);
};

setTimeout(stopAnimation, 5000);

return (
<StyledCircleWrap
Expand All @@ -94,7 +101,11 @@ const LoadingButton = ({ id, className, style, ...rest }) => {
style={style}
onClick={onClick}
>
<StyledCircle percent={percent} isConversion={isConversion}>
<StyledCircle
percent={percent}
inConversion={inConversion}
isAnimation={isAnimation}
>
<div className="circle__mask circle__full">
<div className="circle__fill"></div>
</div>
Expand Down

0 comments on commit 80d6b80

Please sign in to comment.