diff --git a/src/shared/types/commonTypes.ts b/src/shared/types/commonTypes.ts index 211c0ef..168dd0c 100644 --- a/src/shared/types/commonTypes.ts +++ b/src/shared/types/commonTypes.ts @@ -1,2 +1,5 @@ export type AnyFunctional = (...args: any[]) => any; export type ComponentWithClassNameProp = { className?: string }; +export type Optional = { + [P in keyof T]?: T[P] +}; diff --git a/src/shared/ui/Button/ButtonGeneral/ButtonGeneral.tsx b/src/shared/ui/Button/ButtonGeneral/ButtonGeneral.tsx index 4ba79c8..d17a49b 100644 --- a/src/shared/ui/Button/ButtonGeneral/ButtonGeneral.tsx +++ b/src/shared/ui/Button/ButtonGeneral/ButtonGeneral.tsx @@ -25,15 +25,16 @@ export type ButtonGeneralProps = GeneralButtonSquare | GeneralAnchorSquare | GeneralLinkSquare | GeneralButtonIcon; export const ButtonGeneral: FC = (props) => { - const nessaryProps: CommonButtonUIProps = { - size: 'm', - }; - const { children, + typeButton, } = props; - switch (props.typeButton) { + const nessaryProps: CommonButtonUIProps = { + size: 'm', + }; + + switch (typeButton) { case 'ButtonSquare': return ( diff --git a/src/shared/ui/Button/ButtonIconUI/ButtonIconUI.tsx b/src/shared/ui/Button/ButtonIconUI/ButtonIconUI.tsx index f71ab52..28ef9d8 100644 --- a/src/shared/ui/Button/ButtonIconUI/ButtonIconUI.tsx +++ b/src/shared/ui/Button/ButtonIconUI/ButtonIconUI.tsx @@ -9,15 +9,18 @@ export interface ButtonIconUIProps extends CommonButtonUIProps { } export const ButtonIconUI: FC = ({ - children, round, classNameButton, ...restProps + children, round, classNameButton, disabled, invertedTheme, nonInteractive, size, }) => (
{children}
diff --git a/src/shared/ui/Button/ButtonSquare/ButtonSquare.tsx b/src/shared/ui/Button/ButtonSquare/ButtonSquare.tsx index 5848a13..36aa1a7 100644 --- a/src/shared/ui/Button/ButtonSquare/ButtonSquare.tsx +++ b/src/shared/ui/Button/ButtonSquare/ButtonSquare.tsx @@ -20,7 +20,8 @@ export const ButtonSquare: FC = ({ }) => ( , 'className'> { - children: ReactNode; - classNameWrapper?: string; -} +export interface ButtonWrapperProps extends Omit, 'className' | 'children'>, Optional {} export const ButtonWrapper: FC = ({ children, ...restProps }) => ( = ({ - children, tag = 'button', classNameWrapper, ...restProps + children, tag = 'button', classNameWrapper, disabled, nonInteractive, typeButton, ...restProps }) => { if (tag === 'a') { const restPropsCopy = { ...restProps } as WrapperAttributes['a']; @@ -42,7 +46,7 @@ export const Wrapper: FC = ({ const restPropsCopy = { ...restProps } as WrapperAttributes['button']; return ( - );