-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resend export win email functionality
- Loading branch information
Showing
6 changed files
with
81 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react' | ||
import Button from '@govuk-react/button' | ||
|
||
import ProgressIndicator from '../ProgressIndicator' | ||
import Task from '.' | ||
|
||
export const TaskButton = ({ id, name, startOptions, children }) => ( | ||
<Task> | ||
{(getTask) => { | ||
const task = getTask(name, id) | ||
return ( | ||
<Task.Status | ||
id={id} | ||
name={name} | ||
renderProgress={ProgressIndicator.Inline} | ||
> | ||
{() => ( | ||
<Button | ||
disabled={task.progress} | ||
onClick={() => task.start(startOptions)} | ||
> | ||
{children} | ||
</Button> | ||
)} | ||
</Task.Status> | ||
) | ||
}} | ||
</Task> | ||
) |
28 changes: 28 additions & 0 deletions
28
src/client/components/Task/__stories__/TaskButton.stories.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
|
||
import { TaskButton } from '../TaskButton' | ||
|
||
export default { | ||
title: 'Task/TaskButton', | ||
} | ||
|
||
const StyledList = styled('ul')({ | ||
listStyleType: 'none', | ||
}) | ||
|
||
export const List = () => ( | ||
<StyledList> | ||
{[{ id: 1 }, { id: 2 }, { id: 3 }].map((item) => ( | ||
<li> | ||
<TaskButton | ||
id={item.id} | ||
name={'TASK_DO_SOMETHING'} | ||
startOptions={{ payload: item.id }} | ||
> | ||
Do Something | ||
</TaskButton> | ||
</li> | ||
))} | ||
</StyledList> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const TASK_RESEND_EXPORT_WIN = 'TASK_RESEND_EXPORT_WIN' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { apiProxyAxios } from '../../../components/Task/utils' | ||
|
||
export const resendExportWin = (id) => | ||
apiProxyAxios.post(`/v4/export-win/${id}/resend-win`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters