@ltht-react/admin-actions 2.0.189 → 2.0.191
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -16
- package/package.json +9 -9
- package/src/atoms/admin-action-button.tsx +59 -59
- package/src/atoms/admin-action-description.tsx +19 -19
- package/src/index.tsx +5 -5
- package/src/organisms/admin-action.tsx +29 -29
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
# AdminActions
|
|
3
|
-
|
|
4
|
-
<!-- STORY -->
|
|
5
|
-
|
|
6
|
-
### Import
|
|
7
|
-
|
|
8
|
-
```js
|
|
9
|
-
import AdminActions from '@ltht-react/admin-actions'
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
### Usage
|
|
13
|
-
|
|
14
|
-
```jsx
|
|
15
|
-
<AdminActions />
|
|
16
|
-
```
|
|
1
|
+
|
|
2
|
+
# AdminActions
|
|
3
|
+
|
|
4
|
+
<!-- STORY -->
|
|
5
|
+
|
|
6
|
+
### Import
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
import AdminActions from '@ltht-react/admin-actions'
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Usage
|
|
13
|
+
|
|
14
|
+
```jsx
|
|
15
|
+
<AdminActions />
|
|
16
|
+
```
|
|
17
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ltht-react/admin-actions",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.191",
|
|
4
4
|
"description": "ltht-react clinical AdminActions component.",
|
|
5
5
|
"author": "LTHT",
|
|
6
6
|
"homepage": "",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@emotion/react": "^11.0.0",
|
|
30
30
|
"@emotion/styled": "^11.0.0",
|
|
31
|
-
"@ltht-react/button": "^2.0.
|
|
32
|
-
"@ltht-react/hooks": "^2.0.
|
|
33
|
-
"@ltht-react/icon": "^2.0.
|
|
34
|
-
"@ltht-react/styles": "^2.0.
|
|
35
|
-
"@ltht-react/type-summary": "^2.0.
|
|
36
|
-
"@ltht-react/types": "^2.0.
|
|
37
|
-
"@ltht-react/utils": "^2.0.
|
|
31
|
+
"@ltht-react/button": "^2.0.191",
|
|
32
|
+
"@ltht-react/hooks": "^2.0.191",
|
|
33
|
+
"@ltht-react/icon": "^2.0.191",
|
|
34
|
+
"@ltht-react/styles": "^2.0.191",
|
|
35
|
+
"@ltht-react/type-summary": "^2.0.191",
|
|
36
|
+
"@ltht-react/types": "^2.0.191",
|
|
37
|
+
"@ltht-react/utils": "^2.0.191",
|
|
38
38
|
"react": "^18.2.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "c5113953a19f4ed9ae82b545f073b5feb7d5a20b"
|
|
41
41
|
}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import styled from '@emotion/styled'
|
|
2
|
-
import { Button } from '@ltht-react/button'
|
|
3
|
-
import { BTN_COLOURS } from '@ltht-react/styles'
|
|
4
|
-
import { Maybe, Task } from '@ltht-react/types'
|
|
5
|
-
import { FC } from 'react'
|
|
6
|
-
import Icon from '@ltht-react/icon'
|
|
7
|
-
|
|
8
|
-
const SuccessButton = styled(Button)`
|
|
9
|
-
background-color: ${BTN_COLOURS.WORKFLOW.VALUE};
|
|
10
|
-
cursor: auto;
|
|
11
|
-
:hover {
|
|
12
|
-
background-color: ${BTN_COLOURS.WORKFLOW.VALUE};
|
|
13
|
-
cursor: auto !important;
|
|
14
|
-
}
|
|
15
|
-
`
|
|
16
|
-
|
|
17
|
-
const FailButton = styled(Button)`
|
|
18
|
-
background-color: ${BTN_COLOURS.DANGER.VALUE};
|
|
19
|
-
cursor: auto;
|
|
20
|
-
:hover {
|
|
21
|
-
background-color: ${BTN_COLOURS.DANGER.VALUE};
|
|
22
|
-
cursor: auto !important;
|
|
23
|
-
}
|
|
24
|
-
`
|
|
25
|
-
|
|
26
|
-
const ActionButton: FC<IProps> = ({ adminAction, actionClickHandler }) => {
|
|
27
|
-
if (adminAction.isSuccess === true) {
|
|
28
|
-
return <SuccessButton type="button" value="Done" icon={<Icon type="check" size="medium" />} />
|
|
29
|
-
}
|
|
30
|
-
if (adminAction.isSuccess === false) {
|
|
31
|
-
return (
|
|
32
|
-
<FailButton type="button" value={adminAction.failText} icon={<Icon type="cross" size="medium" color="grey" />} />
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<Button
|
|
38
|
-
type="button"
|
|
39
|
-
title="Perform Action"
|
|
40
|
-
value={!adminAction.isLoading ? 'Perform Action' : 'Loading'}
|
|
41
|
-
icon={adminAction.isLoading && <Icon type="spinner" size="medium" />}
|
|
42
|
-
onClick={adminAction.isLoading ? () => undefined : () => actionClickHandler(adminAction)}
|
|
43
|
-
/>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface IProps {
|
|
48
|
-
adminAction: IAdminAction
|
|
49
|
-
actionClickHandler(adminAction: IAdminAction): void
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface IAdminAction {
|
|
53
|
-
task: Task
|
|
54
|
-
isLoading: boolean
|
|
55
|
-
isSuccess: Maybe<boolean>
|
|
56
|
-
failText: string
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default ActionButton
|
|
1
|
+
import styled from '@emotion/styled'
|
|
2
|
+
import { Button } from '@ltht-react/button'
|
|
3
|
+
import { BTN_COLOURS } from '@ltht-react/styles'
|
|
4
|
+
import { Maybe, Task } from '@ltht-react/types'
|
|
5
|
+
import { FC } from 'react'
|
|
6
|
+
import Icon from '@ltht-react/icon'
|
|
7
|
+
|
|
8
|
+
const SuccessButton = styled(Button)`
|
|
9
|
+
background-color: ${BTN_COLOURS.WORKFLOW.VALUE};
|
|
10
|
+
cursor: auto;
|
|
11
|
+
:hover {
|
|
12
|
+
background-color: ${BTN_COLOURS.WORKFLOW.VALUE};
|
|
13
|
+
cursor: auto !important;
|
|
14
|
+
}
|
|
15
|
+
`
|
|
16
|
+
|
|
17
|
+
const FailButton = styled(Button)`
|
|
18
|
+
background-color: ${BTN_COLOURS.DANGER.VALUE};
|
|
19
|
+
cursor: auto;
|
|
20
|
+
:hover {
|
|
21
|
+
background-color: ${BTN_COLOURS.DANGER.VALUE};
|
|
22
|
+
cursor: auto !important;
|
|
23
|
+
}
|
|
24
|
+
`
|
|
25
|
+
|
|
26
|
+
const ActionButton: FC<IProps> = ({ adminAction, actionClickHandler }) => {
|
|
27
|
+
if (adminAction.isSuccess === true) {
|
|
28
|
+
return <SuccessButton type="button" value="Done" icon={<Icon type="check" size="medium" />} />
|
|
29
|
+
}
|
|
30
|
+
if (adminAction.isSuccess === false) {
|
|
31
|
+
return (
|
|
32
|
+
<FailButton type="button" value={adminAction.failText} icon={<Icon type="cross" size="medium" color="grey" />} />
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Button
|
|
38
|
+
type="button"
|
|
39
|
+
title="Perform Action"
|
|
40
|
+
value={!adminAction.isLoading ? 'Perform Action' : 'Loading'}
|
|
41
|
+
icon={adminAction.isLoading && <Icon type="spinner" size="medium" />}
|
|
42
|
+
onClick={adminAction.isLoading ? () => undefined : () => actionClickHandler(adminAction)}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface IProps {
|
|
48
|
+
adminAction: IAdminAction
|
|
49
|
+
actionClickHandler(adminAction: IAdminAction): void
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface IAdminAction {
|
|
53
|
+
task: Task
|
|
54
|
+
isLoading: boolean
|
|
55
|
+
isSuccess: Maybe<boolean>
|
|
56
|
+
failText: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default ActionButton
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { FC } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
import { Maybe } from '@ltht-react/types'
|
|
4
|
-
|
|
5
|
-
const StyledDescription = styled.div`
|
|
6
|
-
flex: 1;
|
|
7
|
-
`
|
|
8
|
-
|
|
9
|
-
const Description: FC<IProps> = (props) => {
|
|
10
|
-
if (props.description) return <StyledDescription>{props.description}</StyledDescription>
|
|
11
|
-
|
|
12
|
-
return null
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface IProps {
|
|
16
|
-
description?: Maybe<string>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default Description
|
|
1
|
+
import { FC } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
import { Maybe } from '@ltht-react/types'
|
|
4
|
+
|
|
5
|
+
const StyledDescription = styled.div`
|
|
6
|
+
flex: 1;
|
|
7
|
+
`
|
|
8
|
+
|
|
9
|
+
const Description: FC<IProps> = (props) => {
|
|
10
|
+
if (props.description) return <StyledDescription>{props.description}</StyledDescription>
|
|
11
|
+
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface IProps {
|
|
16
|
+
description?: Maybe<string>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default Description
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import AdminAction from './organisms/admin-action'
|
|
2
|
-
import { IAdminAction } from './atoms/admin-action-button'
|
|
3
|
-
|
|
4
|
-
export default AdminAction
|
|
5
|
-
export { IAdminAction }
|
|
1
|
+
import AdminAction from './organisms/admin-action'
|
|
2
|
+
import { IAdminAction } from './atoms/admin-action-button'
|
|
3
|
+
|
|
4
|
+
export default AdminAction
|
|
5
|
+
export { IAdminAction }
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { FC } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
import Description from '../atoms/admin-action-description'
|
|
4
|
-
import ActionButton, { IAdminAction } from '../atoms/admin-action-button'
|
|
5
|
-
|
|
6
|
-
const StyledAdminAction = styled.div`
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
const RightSection = styled.div`
|
|
12
|
-
text-align: right;
|
|
13
|
-
`
|
|
14
|
-
|
|
15
|
-
const AdminAction: FC<IProps> = ({ adminAction, actionClickHandler }) => (
|
|
16
|
-
<StyledAdminAction>
|
|
17
|
-
<Description description={adminAction.task.description} />
|
|
18
|
-
<RightSection>
|
|
19
|
-
<ActionButton adminAction={adminAction} actionClickHandler={actionClickHandler} />
|
|
20
|
-
</RightSection>
|
|
21
|
-
</StyledAdminAction>
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
interface IProps {
|
|
25
|
-
adminAction: IAdminAction
|
|
26
|
-
actionClickHandler(adminAction: IAdminAction): void
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default AdminAction
|
|
1
|
+
import { FC } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
import Description from '../atoms/admin-action-description'
|
|
4
|
+
import ActionButton, { IAdminAction } from '../atoms/admin-action-button'
|
|
5
|
+
|
|
6
|
+
const StyledAdminAction = styled.div`
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
const RightSection = styled.div`
|
|
12
|
+
text-align: right;
|
|
13
|
+
`
|
|
14
|
+
|
|
15
|
+
const AdminAction: FC<IProps> = ({ adminAction, actionClickHandler }) => (
|
|
16
|
+
<StyledAdminAction>
|
|
17
|
+
<Description description={adminAction.task.description} />
|
|
18
|
+
<RightSection>
|
|
19
|
+
<ActionButton adminAction={adminAction} actionClickHandler={actionClickHandler} />
|
|
20
|
+
</RightSection>
|
|
21
|
+
</StyledAdminAction>
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
interface IProps {
|
|
25
|
+
adminAction: IAdminAction
|
|
26
|
+
actionClickHandler(adminAction: IAdminAction): void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default AdminAction
|