Web: Client: Data Import: translate ImprotSection to ts

This commit is contained in:
Vladimir Khvan 2024-06-21 15:05:48 +05:00
parent 3bd39de506
commit 5f67cad1dd
2 changed files with 30 additions and 7 deletions

View File

@ -25,14 +25,15 @@
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
import { ReactSVG } from "react-svg"; import { ReactSVG } from "react-svg";
import styled, { css } from "styled-components"; import styled from "styled-components";
import { tablet } from "@docspace/shared/utils/device"; import { tablet } from "@docspace/shared/utils/device";
import { Text } from "@docspace/shared/components/text"; import { Text } from "@docspace/shared/components/text";
import { ToggleButton } from "@docspace/shared/components/toggle-button"; import { ToggleButton } from "@docspace/shared/components/toggle-button";
import ArrowSvg from "PUBLIC_DIR/images/arrow2.react.svg?url"; import ArrowSvg from "PUBLIC_DIR/images/arrow2.react.svg?url";
import { ImportItemProps, ImportSectionProps } from "../types";
const SectionWrapper = styled.div` const SectionWrapper = styled.div<{ isChecked: boolean }>`
max-width: 700px; max-width: 700px;
padding: 12px; padding: 12px;
box-sizing: border-box; box-sizing: border-box;
@ -70,7 +71,7 @@ const FlexContainer = styled.div`
display: flex; display: flex;
`; `;
const ImportItemWrapper = styled.div` const ImportItemWrapper = styled.div<{ isChecked: boolean }>`
padding-top: 8px; padding-top: 8px;
.workspace-title { .workspace-title {
@ -130,7 +131,12 @@ const ArrowWrapper = styled.div`
} }
`; `;
const ImportItem = ({ sectionName, SectionIcon, workspace, isChecked }) => { const ImportItem = ({
sectionName,
SectionIcon,
workspace,
isChecked,
}: ImportItemProps) => {
return ( return (
<ImportItemWrapper isChecked={isChecked}> <ImportItemWrapper isChecked={isChecked}>
<Text <Text
@ -157,12 +163,12 @@ const ImportSection = ({
description, description,
exportSection, exportSection,
importSection, importSection,
}) => { }: ImportSectionProps) => {
return ( return (
<SectionWrapper isChecked={isChecked}> <SectionWrapper isChecked={isChecked}>
<ToggleButton <ToggleButton
isChecked={isChecked} isChecked={isChecked}
onChange={onChange || function () {}} onChange={onChange || (() => {})}
className="toggleButton" className="toggleButton"
isDisabled={isDisabled} isDisabled={isDisabled}
/> />
@ -173,7 +179,7 @@ const ImportSection = ({
<Text fontSize="12px" className="section-description"> <Text fontSize="12px" className="section-description">
{description} {description}
</Text> </Text>
<FlexContainer isChecked={isChecked}> <FlexContainer>
<ImportItem {...exportSection} isChecked={isChecked} /> <ImportItem {...exportSection} isChecked={isChecked} />
<ArrowWrapper> <ArrowWrapper>
<ReactSVG className="arrow-icon" src={ArrowSvg} /> <ReactSVG className="arrow-icon" src={ArrowSvg} />

View File

@ -383,3 +383,20 @@ export interface AccountsPagingProps {
setDataPortion: (leftBoundary: number, rightBoundary: number) => void; setDataPortion: (leftBoundary: number, rightBoundary: number) => void;
pagesPerPage?: number; pagesPerPage?: number;
} }
export interface ImportItemProps {
sectionName: string;
SectionIcon: React.FC<React.SVGProps<SVGElement>>;
workspace: string;
isChecked: boolean;
}
export interface ImportSectionProps {
isDisabled: boolean;
isChecked: boolean;
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
sectionName: string;
description: string;
exportSection: Omit<ImportItemProps, "isChecked">;
importSection: Omit<ImportItemProps, "isChecked">;
}