Skip to content

Commit

Permalink
refactor: use DeleteActionButton component and improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoVictor6 committed Jan 6, 2023
1 parent 4c79aad commit 12a9b60
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions frontend/components/dashboard/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Button from '../basic/buttons/Button';
import Toggle from '../basic/Toggle';
import CommentField from './CommentField';
import DashboardInputField from './DashboardInputField';
import { DeleteActionButton } from './DeleteActionButton';
import GenerateSecretMenu from './GenerateSecretMenu';


Expand All @@ -28,6 +29,10 @@ interface OverrideProps {
pos: number;
comment: string;
}
export interface DeleteRowFunctionProps {
ids: string[];
secretName: string;
}

interface SideBarProps {
toggleSidebar: (value: string) => void;
Expand All @@ -41,7 +46,7 @@ interface SideBarProps {
savePush: () => void;
sharedToHide: string[];
setSharedToHide: (values: string[]) => void;
deleteRow: any;
deleteRow: (props: DeleteRowFunctionProps) => void;
}

/**
Expand Down Expand Up @@ -170,14 +175,9 @@ const SideBar = ({
active={buttonReady}
textDisabled="Saved"
/>
<div className="bg-[#9B3535] opacity-70 hover:opacity-100 w-[4.5rem] h-[2.5rem] rounded-md duration-200 ml-2">
<Button
text={String(t("Delete"))}
onButtonPressed={() => deleteRow({ ids: overrideEnabled ? data.map(secret => secret.id) : [data.filter(secret => secret.type == "shared")[0]?.id], secretName: data[0]?.key })}
color="red"
size="md"
/>
</div>
<DeleteActionButton
onSubmit={() => deleteRow({ ids: overrideEnabled ? data.map(secret => secret.id) : [data.filter(secret => secret.type == "shared")[0]?.id], secretName: data[0]?.key })}
/>
</div>
</div>
};
Expand Down

0 comments on commit 12a9b60

Please sign in to comment.