From a58ac3c6a2653c2e672ec4d2d9fcdd6bc2142e58 Mon Sep 17 00:00:00 2001 From: Jose Manuel Serrano Amaut <a20122128@pucp.pe> Date: Sun, 19 Mar 2023 22:55:48 -0500 Subject: [PATCH] [REF]: Change type name from ActionButton to ActionButtonItem and from DropzoneActions to ActionButtons --- .../DropzoneActionButtons.tsx | 10 +++++----- .../DropzoneButtons/DropzoneButtons.tsx | 10 +++++----- .../dropzone/components/dropzone/Dropzone.tsx | 2 +- .../components/dropzone/DropzoneProps.ts | 10 +++++----- .../dropzone/makeListOfActionButtons.ts | 18 +++++++++--------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/files-ui/components/dropzone/components/DropzoneActionButtons/DropzoneActionButtons.tsx b/src/files-ui/components/dropzone/components/DropzoneActionButtons/DropzoneActionButtons.tsx index f9fbe0f..4612283 100644 --- a/src/files-ui/components/dropzone/components/DropzoneActionButtons/DropzoneActionButtons.tsx +++ b/src/files-ui/components/dropzone/components/DropzoneActionButtons/DropzoneActionButtons.tsx @@ -1,8 +1,8 @@ import * as React from "react"; -interface DropzoneActionButtonsProps {} -const DropzoneActionButtons: React.FC<DropzoneActionButtonsProps> = ( - props: DropzoneActionButtonsProps +interface ActionButtonsProps {} +const ActionButtons: React.FC<ActionButtonsProps> = ( + props: ActionButtonsProps ) => { - return <div>DropzoneActionButtons</div>; + return <div>ActionButtons</div>; }; -export default DropzoneActionButtons; +export default ActionButtons; diff --git a/src/files-ui/components/dropzone/components/DropzoneButtons/DropzoneButtons.tsx b/src/files-ui/components/dropzone/components/DropzoneButtons/DropzoneButtons.tsx index 9215d1d..7e1dae8 100644 --- a/src/files-ui/components/dropzone/components/DropzoneButtons/DropzoneButtons.tsx +++ b/src/files-ui/components/dropzone/components/DropzoneButtons/DropzoneButtons.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { addClassName, Localization } from "../../../../core"; import { MaterialButton } from "../../../material-button"; import { - DropzoneActionButton, + ActionButtonItem, DropzoneActions, } from "../dropzone/DropzoneProps"; import "./DropzoneButtons.scss"; @@ -36,7 +36,7 @@ const DropzoneButtons: React.FC<DropzoneButtonsProps> = ( disabled, } = props; - const actionButtonsList: DropzoneActionButton[] = [ + const actionButtonsList: ActionButtonItem[] = [ cleanButton ? { ...cleanButton, label: "Clean", onClick: onClean } : undefined, @@ -50,8 +50,8 @@ const DropzoneButtons: React.FC<DropzoneButtonsProps> = ( ? { ...abortButton, label: "Abort", onClick: onAbort } : undefined, ].filter( - (ab: DropzoneActionButton | undefined) => ab !== undefined - ) as DropzoneActionButton[]; + (ab: ActionButtonItem | undefined) => ab !== undefined + ) as ActionButtonItem[]; const tailClassName:string = `${top ? " top" : " bottom"}`; const finalClassName = addClassName( @@ -62,7 +62,7 @@ const DropzoneButtons: React.FC<DropzoneButtonsProps> = ( return ( <div className={finalClassName} style={containerStyle}> {actionButtonsList.map( - (actionButtonProps: DropzoneActionButton, index: number) => { + (actionButtonProps: ActionButtonItem, index: number) => { const { children, label, resetStyles, className, style, onClick } = actionButtonProps; return ( diff --git a/src/files-ui/components/dropzone/components/dropzone/Dropzone.tsx b/src/files-ui/components/dropzone/components/dropzone/Dropzone.tsx index d05306c..e0d4e2d 100644 --- a/src/files-ui/components/dropzone/components/dropzone/Dropzone.tsx +++ b/src/files-ui/components/dropzone/components/dropzone/Dropzone.tsx @@ -35,7 +35,7 @@ import { ActionButtons, defaultDrozoneProps, // DEFAULT_BORDER_RADIUS, - //DropzoneActionButton, + //ActionButton, //DropzoneActions, DropzoneProps, FooterConfig, diff --git a/src/files-ui/components/dropzone/components/dropzone/DropzoneProps.ts b/src/files-ui/components/dropzone/components/dropzone/DropzoneProps.ts index b2d2e5c..5bf2d83 100644 --- a/src/files-ui/components/dropzone/components/dropzone/DropzoneProps.ts +++ b/src/files-ui/components/dropzone/components/dropzone/DropzoneProps.ts @@ -252,7 +252,7 @@ export type FooterConfig = { } -export type DropzoneActionButton = { +export type ActionButtonItem = { children?: JSX.Element; label?: string; style?: React.CSSProperties; @@ -266,10 +266,10 @@ export interface DropzoneActions { position?: "top" | "bottom"; style?: React.CSSProperties; className?: string; - uploadButton?: DropzoneActionButton; - abortButton?: DropzoneActionButton; - deleteButton?: DropzoneActionButton; - cleanButton?: DropzoneActionButton; + uploadButton?: ActionButtonItem; + abortButton?: ActionButtonItem; + deleteButton?: ActionButtonItem; + cleanButton?: ActionButtonItem; } export type ActionButtons = { [P in keyof DropzoneActions]: DropzoneActions[P] diff --git a/src/files-ui/components/dropzone/makeListOfActionButtons.ts b/src/files-ui/components/dropzone/makeListOfActionButtons.ts index bb53906..b26efc2 100644 --- a/src/files-ui/components/dropzone/makeListOfActionButtons.ts +++ b/src/files-ui/components/dropzone/makeListOfActionButtons.ts @@ -1,4 +1,4 @@ -import { DropzoneActionButton } from "./components/dropzone/DropzoneProps"; +import { ActionButtonItem } from "./components/dropzone/DropzoneProps"; /** * @@ -8,14 +8,14 @@ import { DropzoneActionButton } from "./components/dropzone/DropzoneProps"; * @param other array of other custom action buttons props * @returns */ -export const makeListOfActionButtons = ( - uploadButton: DropzoneActionButton | undefined, - abortButton: DropzoneActionButton | undefined, - deleteButton: DropzoneActionButton | undefined, - cleanButton: DropzoneActionButton | undefined -): [DropzoneActionButton[], DropzoneActionButton[]] => { - let listOfTopButtons: DropzoneActionButton[] = []; - let listOfBottomButtons: DropzoneActionButton[] = []; +export const makeListOfActionButtonItems = ( + uploadButton: ActionButtonItem | undefined, + abortButton: ActionButtonItem | undefined, + deleteButton: ActionButtonItem | undefined, + cleanButton: ActionButtonItem | undefined +): [ActionButtonItem[], ActionButtonItem[]] => { + let listOfTopButtons: ActionButtonItem[] = []; + let listOfBottomButtons: ActionButtonItem[] = []; /* if (uploadButton) { uploadButton.position === "top" ? listOfTopButtons.push(uploadButton) -- GitLab