diff --git a/src/components/progressSpace/index.tsx b/src/components/progressSpace/index.tsx new file mode 100644 index 0000000..ba3753a --- /dev/null +++ b/src/components/progressSpace/index.tsx @@ -0,0 +1,33 @@ +import { motion } from "framer-motion"; +import { ProgressSpaceProps } from "../../types/props"; + +const ProgressSpace = ({ startSpace, endSpace }: ProgressSpaceProps) => { + let startSpacePercentage; + if (typeof endSpace === "number") { + startSpacePercentage = (startSpace / endSpace) * 100; + } + return ( +
+
+ حجم + {startSpace} + GB +
+
+ +
+
+ {endSpace} + GB +
+
+ ); +}; + +export default ProgressSpace; diff --git a/src/pages/profile/section/components/ConfigItem.tsx b/src/pages/profile/section/components/ConfigItem.tsx index bf2ec89..5898cd9 100644 --- a/src/pages/profile/section/components/ConfigItem.tsx +++ b/src/pages/profile/section/components/ConfigItem.tsx @@ -3,9 +3,16 @@ import Button from "../../../../components/button"; import { ConfigItemProps } from "../../../../types/props"; import ModalConfigDetails from "./ModalConfigDetails"; import { useState } from "react"; +import Dropdown, { DropdownItem } from "../../../../components/dropdown"; +import ProgressSpace from "../../../../components/progressSpace"; const ConfigItem = ({ dateBuy, configName, isDisabled }: ConfigItemProps) => { const [isOpen, setIsOpen] = useState(false); + const [isOpenDropDown, setIsOpenDropDown] = useState(false); + const handleToggle = () => { + setIsOpenDropDown(!isOpen); + }; + return ( <> { {configName}
- - + + + + + +
- )}
+ {!isDisabled && ( +
+ +
+ )} ); diff --git a/src/types/props.d.ts b/src/types/props.d.ts index e4e3546..3257311 100644 --- a/src/types/props.d.ts +++ b/src/types/props.d.ts @@ -8,9 +8,8 @@ export interface AlertProps { } // begin Button.tsx -export interface ButtonProps { +export interface ButtonProps extends ButtonHTMLAttributes { children: React.ReactNode; - onClick?: () => void; extra?: string; active?: boolean; } @@ -50,7 +49,14 @@ export interface NavData { } // begin ListTutorial.tsx -import React, { Component, InputHTMLAttributes, SetStateAction } from "react"; +import React, { + ButtonHTMLAttributes, + Component, + Dispatch, + InputHTMLAttributes, + ReactNode, + SetStateAction, +} from "react"; export type TutorialList = { id: number; name: string }[]; @@ -112,3 +118,20 @@ export interface ConfigItemProps { isDisabled: boolean; } +// نوع Item برای آیتم‌های داخل Dropdown +export interface DropdownItem { + label: string; + value: string; + onClick: () => void; +} + +export interface DropdownProps { + isOpen: boolean; + setIsOpen: Dispatch>; + children: ReactNode | ReactNode[]; +} + +export interface ProgressSpaceProps { + startSpace: number; + endSpace: number | "ultimate"; +}