Skip to content

Commit

Permalink
Merge pull request #76 from bcgov/SPR-174-Refactor-Delete-Prompt
Browse files Browse the repository at this point in the history
SPR-174 DeletePrompt Refactor
  • Loading branch information
dbarkowsky authored Jul 5, 2023
2 parents 55b58a9 + 62a790b commit 325dcc7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion app/src/components/custom/forms/RequestForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ const RequestForm = (props: RequestFormProps) => {
<DeletePrompt
deleteHandler={handleDelete}
title='Delete Request?'
blurb='Are you sure you want to delete this request?;;This action will hide the request from the requestor and may only be undone by an administrator.'
blurb={[
'Are you sure you want to delete this request?',
'This action will hide the request from the requestor and may only be undone by an administrator.',
]}
id='deletePrompt'
/>
<Paper
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/custom/modals/DeletePrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { buttonStyles } from '../../bcgov/ButtonStyles';
interface DeletePromptProps {
deleteHandler: () => void;
title: string;
blurb: string;
blurb: string[];
id: string;
}

Expand Down Expand Up @@ -41,7 +41,7 @@ const DeletePrompt = (props: DeletePromptProps) => {
>
{title}
</h4>
{blurb.split(';;').map((paragraph, index) => {
{blurb.map((paragraph, index) => {
const key = `blurb${title}${index}`;
return (
<p key={key} style={{ textAlign: 'start' }}>
Expand Down
5 changes: 4 additions & 1 deletion app/src/components/custom/tables/ApprovalTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ const ApprovalTable = (props: ApprovalTableProps) => {
<DeletePrompt
id='approvalRemove'
title='Remove Approval?'
blurb='Are you sure you want to remove this approval?;;This is not recoverable, except by leaving this request without updating.'
blurb={[
'Are you sure you want to remove this approval?',
'This is not recoverable, except by leaving this request without updating.',
]}
deleteHandler={removeApproval}
/>
<Table aria-label='approval-files'>
Expand Down
5 changes: 4 additions & 1 deletion app/src/components/custom/uploaders/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ const FileUpload = (props: FileUploadProps) => {
<DeletePrompt
id={`fileDelete${source}${index}`}
title='Remove File?'
blurb='Are you sure you want to remove this file?;;This is not recoverable, except by leaving this request without updating.'
blurb={[
'Are you sure you want to remove this file?',
'This is not recoverable, except by leaving this request without updating.',
]}
deleteHandler={() => {
const tempFiles: IFile[] = [...files];
delete tempFiles[index].file;
Expand Down

0 comments on commit 325dcc7

Please sign in to comment.