Web: Moving style components, adding a class to get rid of the import of components from the Common module in the ColorTheme components.

This commit is contained in:
Vlada Gazizova 2023-05-24 18:30:20 +03:00
parent b72b96c8c9
commit 95c834ed6b
2 changed files with 83 additions and 8 deletions

View File

@ -1,11 +1,83 @@
import React, { useState, useEffect } from "react";
import { inject, observer } from "mobx-react";
import {
StyledCircle,
StyledLoadingButton,
} from "@docspace/common/components/StyledLoadingButton";
import styled, { css, keyframes } from "styled-components";
import { ColorTheme, ThemeType } from "@docspace/components/ColorTheme";
import { Base } from "@docspace/components/themes";
import { ColorTheme, ThemeType } from "@docspace/common/components/ColorTheme";
const rotate360 = keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`;
const StyledLoadingButton = styled.div`
width: 12px;
height: 12px;
border-radius: 50%;
text-align: center;
line-height: 12px;
background: ${(props) =>
props.theme.filesPanels.upload.loadingButton.background};
position: absolute;
margin: 2px;
font-size: 16px;
font-weight: bold;
color: ${(props) => props.theme.filesPanels.upload.loadingButton.color};
`;
StyledLoadingButton.defaultProps = { theme: Base };
const StyledCircle = styled.div`
.circle__mask,
.circle__fill {
width: 16px;
height: 16px;
position: absolute;
border-radius: 50%;
}
${(props) =>
props.percent === 0 || (props.isAnimation && props.inConversion)
? css`
.circle__fill {
animation: ${rotate360} 2s linear infinite;
transform: translate(0);
}
`
: css`
.circle__mask {
clip: rect(0px, 16px, 16px, 8px);
}
.circle__fill {
animation: fill-rotate ease-in-out none;
transform: rotate(${(props) => props.percent * 1.8}deg);
}
`}
.circle__mask .circle__fill {
clip: rect(0px, 8px, 16px, 0px);
background-color: ${(props) =>
props.theme.filesPanels.upload.loadingButton.color};
}
.circle__mask.circle__full {
animation: fill-rotate ease-in-out none;
transform: rotate(${(props) => props.percent * 1.8}deg);
}
@keyframes fill-rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(${(props) => props.percent * 1.8}deg);
}
}
`;
const LoadingButton = (props) => {
const {
@ -52,7 +124,10 @@ const LoadingButton = (props) => {
<div className="circle__fill"></div>
</div>
<StyledLoadingButton isConversion={isConversion}>
<StyledLoadingButton
className="loading-button"
isConversion={isConversion}
>
{!inConversion && <>&times;</>}
</StyledLoadingButton>
</StyledCircle>

View File

@ -22,7 +22,7 @@ import ButtonPlusIcon from "PUBLIC_DIR/images/actions.button.plus.react.svg";
import ButtonMinusIcon from "PUBLIC_DIR/images/actions.button.minus.react.svg";
import CloseIcon from "PUBLIC_DIR/images/close-icon.react.svg";
import { ColorTheme, ThemeType } from "@docspace/common/components/ColorTheme";
import { ColorTheme, ThemeType } from "@docspace/components/ColorTheme";
const StyledButtonAlertIcon = styled(ButtonAlertIcon)`
${commonIconsStyles}
@ -88,7 +88,7 @@ const FloatingButton = (props) => {
</div>
<StyledFloatingButton className="circle__background" color={color}>
<IconBox>
<IconBox className="icon-box">
{icon == "upload" ? (
<ButtonUploadIcon />
) : icon == "file" ? (