@ltht-react/diagnosis-summary 2.0.74 → 2.0.77

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 CHANGED
@@ -1,22 +1,22 @@
1
- # DiagnosisSummary
2
-
3
- <!-- STORY -->
4
-
5
- ### Import
6
-
7
- ```js
8
- import DiagnosisSummary from '@ltht-react/diagnosis-summary'
9
- ```
10
-
11
- ### Usage
12
-
13
- ```jsx
14
- <DiagnosisSummary title="Conditions" conditions={conditions} clickHandler={handleCLick} />
15
- ```
16
-
17
- ### Properties
18
-
19
- | Prop | Required | Default | Type | Description |
20
- | :------------- | :------- | :-------- | :---------- | :------------------------------------------------------------ |
21
- | `conditions` | Yes | | Condition[] | Array of conditions to display |
22
- | `clickHandler` | No | undefined | Function | Callback click handler containing the selected condition item |
1
+ # DiagnosisSummary
2
+
3
+ <!-- STORY -->
4
+
5
+ ### Import
6
+
7
+ ```js
8
+ import DiagnosisSummary from '@ltht-react/diagnosis-summary'
9
+ ```
10
+
11
+ ### Usage
12
+
13
+ ```jsx
14
+ <DiagnosisSummary title="Conditions" conditions={conditions} clickHandler={handleCLick} />
15
+ ```
16
+
17
+ ### Properties
18
+
19
+ | Prop | Required | Default | Type | Description |
20
+ | :------------- | :------- | :-------- | :---------- | :------------------------------------------------------------ |
21
+ | `conditions` | Yes | | Condition[] | Array of conditions to display |
22
+ | `clickHandler` | No | undefined | Function | Callback click handler containing the selected condition item |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ltht-react/diagnosis-summary",
3
- "version": "2.0.74",
3
+ "version": "2.0.77",
4
4
  "description": "ltht-react clinical DiagnosisSummary component.",
5
5
  "author": "LTHT",
6
6
  "homepage": "",
@@ -28,15 +28,15 @@
28
28
  "dependencies": {
29
29
  "@emotion/react": "^11.0.0",
30
30
  "@emotion/styled": "^11.0.0",
31
- "@ltht-react/button": "^2.0.74",
32
- "@ltht-react/hooks": "^2.0.74",
33
- "@ltht-react/icon": "^2.0.74",
34
- "@ltht-react/list": "^2.0.74",
35
- "@ltht-react/styles": "^2.0.74",
36
- "@ltht-react/type-summary": "^2.0.74",
37
- "@ltht-react/types": "^2.0.74",
38
- "@ltht-react/utils": "^2.0.74",
31
+ "@ltht-react/button": "^2.0.77",
32
+ "@ltht-react/hooks": "^2.0.77",
33
+ "@ltht-react/icon": "^2.0.77",
34
+ "@ltht-react/list": "^2.0.77",
35
+ "@ltht-react/styles": "^2.0.77",
36
+ "@ltht-react/type-summary": "^2.0.77",
37
+ "@ltht-react/types": "^2.0.77",
38
+ "@ltht-react/utils": "^2.0.77",
39
39
  "react": "^18.2.0"
40
40
  },
41
- "gitHead": "831a9ec0b1383eb5cfcea9e6ab98446eeb6a5369"
41
+ "gitHead": "53c40ac4140145dda19a2eb0bd719119b50bed4e"
42
42
  }
@@ -1,31 +1,31 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { Condition } from '@ltht-react/types'
6
- import { codeableConceptDisplaySummary } from '@ltht-react/utils'
7
-
8
- const StyledConditionCategory = styled.div<IStyledDescription>`
9
- color: ${TEXT_COLOURS.SECONDARY.VALUE};
10
- text-align: left;
11
- font-size: smaller;
12
- padding-top: 0.25rem;
13
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
14
- `
15
-
16
- const DiagnosisCategory: FC<Props> = ({ condition, enteredInError, ...rest }) => (
17
- <StyledConditionCategory enteredInError={enteredInError} {...rest}>
18
- {codeableConceptDisplaySummary(condition.severity)}
19
- </StyledConditionCategory>
20
- )
21
-
22
- interface Props extends HTMLAttributes<HTMLDivElement> {
23
- condition: Condition
24
- enteredInError: boolean
25
- }
26
-
27
- interface IStyledDescription {
28
- enteredInError: boolean
29
- }
30
-
31
- export default DiagnosisCategory
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { Condition } from '@ltht-react/types'
6
+ import { codeableConceptDisplaySummary } from '@ltht-react/utils'
7
+
8
+ const StyledConditionCategory = styled.div<IStyledDescription>`
9
+ color: ${TEXT_COLOURS.SECONDARY.VALUE};
10
+ text-align: left;
11
+ font-size: smaller;
12
+ padding-top: 0.25rem;
13
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
14
+ `
15
+
16
+ const DiagnosisCategory: FC<Props> = ({ condition, enteredInError, ...rest }) => (
17
+ <StyledConditionCategory enteredInError={enteredInError} {...rest}>
18
+ {codeableConceptDisplaySummary(condition.severity)}
19
+ </StyledConditionCategory>
20
+ )
21
+
22
+ interface Props extends HTMLAttributes<HTMLDivElement> {
23
+ condition: Condition
24
+ enteredInError: boolean
25
+ }
26
+
27
+ interface IStyledDescription {
28
+ enteredInError: boolean
29
+ }
30
+
31
+ export default DiagnosisCategory
@@ -1,39 +1,39 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { Condition } from '@ltht-react/types'
6
-
7
- import { getBooleanExtension } from '@ltht-react/utils'
8
-
9
- const StyledOnsetEstimated = styled.div<IStyledDescription>`
10
- color: ${TEXT_COLOURS.INFO};
11
- font-size: x-small;
12
- white-space: pre-wrap;
13
- display: inline-block;
14
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
15
- `
16
-
17
- const DiagnosisOnsetEstimated: FC<Props> = ({ condition, enteredInError, ...rest }) => {
18
- const onsetDateEstimated = getBooleanExtension(
19
- condition.extension,
20
- 'https://fhir.leedsth.nhs.uk/ValueSet/diagnosis-onset-date-estimated-1'
21
- )
22
-
23
- return (
24
- <StyledOnsetEstimated enteredInError={enteredInError} {...rest}>
25
- {onsetDateEstimated ? ' (estimated)' : ''}
26
- </StyledOnsetEstimated>
27
- )
28
- }
29
-
30
- interface Props extends HTMLAttributes<HTMLDivElement> {
31
- condition: Condition
32
- enteredInError: boolean
33
- }
34
-
35
- interface IStyledDescription {
36
- enteredInError: boolean
37
- }
38
-
39
- export default DiagnosisOnsetEstimated
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { Condition } from '@ltht-react/types'
6
+
7
+ import { getBooleanExtension } from '@ltht-react/utils'
8
+
9
+ const StyledOnsetEstimated = styled.div<IStyledDescription>`
10
+ color: ${TEXT_COLOURS.INFO};
11
+ font-size: x-small;
12
+ white-space: pre-wrap;
13
+ display: inline-block;
14
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
15
+ `
16
+
17
+ const DiagnosisOnsetEstimated: FC<Props> = ({ condition, enteredInError, ...rest }) => {
18
+ const onsetDateEstimated = getBooleanExtension(
19
+ condition.extension,
20
+ 'https://fhir.leedsth.nhs.uk/ValueSet/diagnosis-onset-date-estimated-1'
21
+ )
22
+
23
+ return (
24
+ <StyledOnsetEstimated enteredInError={enteredInError} {...rest}>
25
+ {onsetDateEstimated ? ' (estimated)' : ''}
26
+ </StyledOnsetEstimated>
27
+ )
28
+ }
29
+
30
+ interface Props extends HTMLAttributes<HTMLDivElement> {
31
+ condition: Condition
32
+ enteredInError: boolean
33
+ }
34
+
35
+ interface IStyledDescription {
36
+ enteredInError: boolean
37
+ }
38
+
39
+ export default DiagnosisOnsetEstimated
@@ -1,38 +1,38 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { Condition } from '@ltht-react/types'
6
- import { titleCase } from '@ltht-react/utils'
7
-
8
- const StyledConditionStatus = styled.div<IStyledDescription>`
9
- color: ${TEXT_COLOURS.SECONDARY.VALUE};
10
- text-align: left;
11
- font-size: smaller;
12
- padding-top: 0.25rem;
13
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
14
- `
15
-
16
- const DiagnosisStatus: FC<Props> = ({ condition, enteredInError, ...rest }) => {
17
- const values = []
18
-
19
- if (condition.clinicalStatus) values.push(titleCase(condition.clinicalStatus))
20
- if (condition.verificationStatus) values.push(titleCase(condition.verificationStatus))
21
-
22
- return (
23
- <StyledConditionStatus enteredInError={enteredInError} {...rest}>
24
- {values.length > 0 ? values.join(' - ') : 'Insufficient data provided'}
25
- </StyledConditionStatus>
26
- )
27
- }
28
-
29
- interface Props extends HTMLAttributes<HTMLDivElement> {
30
- condition: Condition
31
- enteredInError: boolean
32
- }
33
-
34
- interface IStyledDescription {
35
- enteredInError: boolean
36
- }
37
-
38
- export default DiagnosisStatus
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { Condition } from '@ltht-react/types'
6
+ import { titleCase } from '@ltht-react/utils'
7
+
8
+ const StyledConditionStatus = styled.div<IStyledDescription>`
9
+ color: ${TEXT_COLOURS.SECONDARY.VALUE};
10
+ text-align: left;
11
+ font-size: smaller;
12
+ padding-top: 0.25rem;
13
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
14
+ `
15
+
16
+ const DiagnosisStatus: FC<Props> = ({ condition, enteredInError, ...rest }) => {
17
+ const values = []
18
+
19
+ if (condition.clinicalStatus) values.push(titleCase(condition.clinicalStatus))
20
+ if (condition.verificationStatus) values.push(titleCase(condition.verificationStatus))
21
+
22
+ return (
23
+ <StyledConditionStatus enteredInError={enteredInError} {...rest}>
24
+ {values.length > 0 ? values.join(' - ') : 'Insufficient data provided'}
25
+ </StyledConditionStatus>
26
+ )
27
+ }
28
+
29
+ interface Props extends HTMLAttributes<HTMLDivElement> {
30
+ condition: Condition
31
+ enteredInError: boolean
32
+ }
33
+
34
+ interface IStyledDescription {
35
+ enteredInError: boolean
36
+ }
37
+
38
+ export default DiagnosisStatus
@@ -1,39 +1,39 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { Condition } from '@ltht-react/types'
6
- import { codeableConceptTextSummary, titleCase } from '@ltht-react/utils'
7
-
8
- const StyledConditionTitle = styled.div<IStyledDescription>`
9
- color: ${TEXT_COLOURS.PRIMARY};
10
- text-align: left;
11
- text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
12
- `
13
-
14
- const DiagnosisTitle: FC<Props> = ({ condition, enteredInError, ...rest }) => {
15
- const codes = []
16
- const snippets = []
17
-
18
- if (condition.code) codes.push(condition.code)
19
- snippets.push(codeableConceptTextSummary(codes))
20
- if (condition.clinicalStatus) snippets.push(titleCase(condition.clinicalStatus))
21
- if (condition.verificationStatus) snippets.push(titleCase(condition.verificationStatus))
22
-
23
- return (
24
- <StyledConditionTitle enteredInError={enteredInError} {...rest}>
25
- {snippets.length > 0 ? snippets.join(', ') : 'Insufficient data provided'}
26
- </StyledConditionTitle>
27
- )
28
- }
29
-
30
- interface Props extends HTMLAttributes<HTMLDivElement> {
31
- condition: Condition
32
- enteredInError: boolean
33
- }
34
-
35
- interface IStyledDescription {
36
- enteredInError: boolean
37
- }
38
-
39
- export default DiagnosisTitle
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { Condition } from '@ltht-react/types'
6
+ import { codeableConceptTextSummary, titleCase } from '@ltht-react/utils'
7
+
8
+ const StyledConditionTitle = styled.div<IStyledDescription>`
9
+ color: ${TEXT_COLOURS.PRIMARY};
10
+ text-align: left;
11
+ text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
12
+ `
13
+
14
+ const DiagnosisTitle: FC<Props> = ({ condition, enteredInError, ...rest }) => {
15
+ const codes = []
16
+ const snippets = []
17
+
18
+ if (condition.code) codes.push(condition.code)
19
+ snippets.push(codeableConceptTextSummary(codes))
20
+ if (condition.clinicalStatus) snippets.push(titleCase(condition.clinicalStatus))
21
+ if (condition.verificationStatus) snippets.push(titleCase(condition.verificationStatus))
22
+
23
+ return (
24
+ <StyledConditionTitle enteredInError={enteredInError} {...rest}>
25
+ {snippets.length > 0 ? snippets.join(', ') : 'Insufficient data provided'}
26
+ </StyledConditionTitle>
27
+ )
28
+ }
29
+
30
+ interface Props extends HTMLAttributes<HTMLDivElement> {
31
+ condition: Condition
32
+ enteredInError: boolean
33
+ }
34
+
35
+ interface IStyledDescription {
36
+ enteredInError: boolean
37
+ }
38
+
39
+ export default DiagnosisTitle
package/src/index.tsx CHANGED
@@ -1,3 +1,3 @@
1
- import DiagnosisSummary from './organisms/diagnosis-summary'
2
-
3
- export default DiagnosisSummary
1
+ import DiagnosisSummary from './organisms/diagnosis-summary'
2
+
3
+ export default DiagnosisSummary
@@ -1,31 +1,31 @@
1
- import { FC } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { Condition } from '@ltht-react/types'
5
- import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
6
-
7
- const StyledRedactedDescription = styled.div`
8
- flex-grow: 1;
9
- text-align: left;
10
- `
11
-
12
- const StyledDateSummary = styled.div`
13
- text-align: right;
14
- `
15
-
16
- const DiagnosisRedacted: FC<Props> = ({ condition }) => (
17
- <>
18
- <StyledRedactedDescription>
19
- <RedactedDescription />
20
- </StyledRedactedDescription>
21
- <StyledDateSummary>
22
- <DateSummary datetime={condition?.onset?.dateTime} />
23
- </StyledDateSummary>
24
- </>
25
- )
26
-
27
- interface Props {
28
- condition?: Condition | null
29
- }
30
-
31
- export default DiagnosisRedacted
1
+ import { FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { Condition } from '@ltht-react/types'
5
+ import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
6
+
7
+ const StyledRedactedDescription = styled.div`
8
+ flex-grow: 1;
9
+ text-align: left;
10
+ `
11
+
12
+ const StyledDateSummary = styled.div`
13
+ text-align: right;
14
+ `
15
+
16
+ const DiagnosisRedacted: FC<Props> = ({ condition }) => (
17
+ <>
18
+ <StyledRedactedDescription>
19
+ <RedactedDescription />
20
+ </StyledRedactedDescription>
21
+ <StyledDateSummary>
22
+ <DateSummary datetime={condition?.onset?.dateTime} />
23
+ </StyledDateSummary>
24
+ </>
25
+ )
26
+
27
+ interface Props {
28
+ condition?: Condition | null
29
+ }
30
+
31
+ export default DiagnosisRedacted
@@ -1,165 +1,165 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { Condition, ConditionVerificationStatus } from '@ltht-react/types'
5
- import { DateSummary } from '@ltht-react/type-summary'
6
- import Icon from '@ltht-react/icon'
7
- import { Button, ButtonProps } from '@ltht-react/button'
8
-
9
- import { BTN_COLOURS, MOBILE_MAXIMUM_MEDIA_QUERY, SMALL_SCREEN_MAXIMUM_MEDIA_QUERY } from '@ltht-react/styles'
10
- import Category from '../atoms/diagnosis-category'
11
- import Title from '../atoms/diagnosis-title'
12
- import OnsetDateEstimated from '../atoms/diagnosis-onset-estimated'
13
- import Redacted from '../molecules/diagnosis-redacted'
14
-
15
- const StyledTitle = styled.div`
16
- display: inline-block;
17
- `
18
- const StyledSummary = styled.div`
19
- display: flex;
20
- justify-content: center;
21
- `
22
- const StyledDescription = styled.div`
23
- flex-grow: 1;
24
- `
25
- const StyledLeftContainer = styled.div`
26
- display: flex;
27
- flex-grow: 1;
28
- flex-direction: row;
29
-
30
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
31
- flex-direction: column;
32
- }
33
- `
34
- const StyledControlsContainer = styled.div`
35
- display: flex;
36
- margin: auto 10px auto 10px;
37
- flex-direction: column;
38
-
39
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
40
- margin: 10px 0 0 0;
41
- flex-flow: row wrap;
42
- }
43
-
44
- ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
45
- margin: 10px 5px 0 0;
46
- flex-direction: column;
47
- }
48
- `
49
- const StyledButton = styled(Button)`
50
- margin: 2px 0 2px 0;
51
- font-size: 0.8em !important;
52
- padding: 1px 5px;
53
-
54
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
55
- margin: 2px 5px 2px 0;
56
- width: fit-content;
57
- }
58
-
59
- ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
60
- margin: 2px 0 2px 0;
61
- width: 100%;
62
- max-width: 200px;
63
- }
64
- `
65
-
66
- const StyledDate = styled.div`
67
- text-align: left;
68
- width: 15%;
69
- `
70
- const IconButtonWrapper = styled(Button)`
71
- -webkit-box-align: center;
72
- align-items: center;
73
- -webkit-box-pack: center;
74
- justify-content: center;
75
- margin-right: 0.5rem;
76
- display: inline-block !important;
77
- margin-left: 0.5rem;
78
- width: auto;
79
- `
80
- const IconWrapper = styled.div`
81
- margin-left: 0.5rem;
82
- display: inline-block;
83
- `
84
-
85
- const DiagnosisSummary: FC<Props> = ({
86
- condition,
87
- extendedTemplateDisplayName,
88
- extensionTemplateDisplayName,
89
- extensionClickHandler,
90
- isReadOnly = false,
91
- dateOnlyView = false,
92
- canExtendDiagnosis = false,
93
- controls = [],
94
- ...rest
95
- }) => {
96
- if (condition.metadata.isRedacted) {
97
- return (
98
- <StyledSummary {...rest}>
99
- <Redacted condition={condition} />
100
- </StyledSummary>
101
- )
102
- }
103
-
104
- const enteredInError = condition.verificationStatus === ConditionVerificationStatus.EnteredInError
105
-
106
- return (
107
- <StyledSummary {...rest}>
108
- <StyledLeftContainer>
109
- <StyledDescription>
110
- <StyledTitle>
111
- <Title enteredInError={enteredInError} condition={condition} />
112
- </StyledTitle>
113
- {extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && (
114
- <IconButtonWrapper
115
- onClick={extensionClickHandler}
116
- type="button"
117
- styling={{ buttonStyle: 'clear' }}
118
- value=""
119
- icon={<Icon type="folder-plus" size="medium" />}
120
- iconPlacement="center"
121
- iconColour={BTN_COLOURS.PRIMARY.VALUE}
122
- title={`This diagnosis can be extended further using form '${extensionTemplateDisplayName}' by clicking here`}
123
- />
124
- )}
125
- {extendedTemplateDisplayName && (
126
- <IconWrapper>
127
- <Icon
128
- type="comment"
129
- size="medium"
130
- title={`This diagnosis has been extended beyond standard diagnosis with form '${extendedTemplateDisplayName}'.
131
- To view these extra details, click into the full diagnosis detail or edit the existing form.`}
132
- />
133
- </IconWrapper>
134
- )}
135
- <Category enteredInError={enteredInError} condition={condition} />
136
- </StyledDescription>
137
-
138
- {!isReadOnly && controls.length > 0 && (
139
- <StyledControlsContainer>
140
- {controls.map((props, index) => (
141
- <StyledButton key={index} {...props} />
142
- ))}
143
- </StyledControlsContainer>
144
- )}
145
- </StyledLeftContainer>
146
- <StyledDate>
147
- <DateSummary enteredInError={enteredInError} datetime={condition?.assertedDate} dateOnlyView={dateOnlyView} />
148
- <OnsetDateEstimated enteredInError={enteredInError} condition={condition} />
149
- </StyledDate>
150
- </StyledSummary>
151
- )
152
- }
153
-
154
- interface Props extends HTMLAttributes<HTMLDivElement> {
155
- condition: Condition
156
- extendedTemplateDisplayName?: string | undefined
157
- extensionTemplateDisplayName?: string | undefined
158
- extensionClickHandler?(): void
159
- isReadOnly: boolean
160
- dateOnlyView?: boolean
161
- controls?: ButtonProps[]
162
- canExtendDiagnosis?: boolean
163
- }
164
-
165
- export default DiagnosisSummary
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { Condition, ConditionVerificationStatus } from '@ltht-react/types'
5
+ import { DateSummary } from '@ltht-react/type-summary'
6
+ import Icon from '@ltht-react/icon'
7
+ import { Button, ButtonProps } from '@ltht-react/button'
8
+
9
+ import { BTN_COLOURS, MOBILE_MAXIMUM_MEDIA_QUERY, SMALL_SCREEN_MAXIMUM_MEDIA_QUERY } from '@ltht-react/styles'
10
+ import Category from '../atoms/diagnosis-category'
11
+ import Title from '../atoms/diagnosis-title'
12
+ import OnsetDateEstimated from '../atoms/diagnosis-onset-estimated'
13
+ import Redacted from '../molecules/diagnosis-redacted'
14
+
15
+ const StyledTitle = styled.div`
16
+ display: inline-block;
17
+ `
18
+ const StyledSummary = styled.div`
19
+ display: flex;
20
+ justify-content: center;
21
+ `
22
+ const StyledDescription = styled.div`
23
+ flex-grow: 1;
24
+ `
25
+ const StyledLeftContainer = styled.div`
26
+ display: flex;
27
+ flex-grow: 1;
28
+ flex-direction: row;
29
+
30
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
31
+ flex-direction: column;
32
+ }
33
+ `
34
+ const StyledControlsContainer = styled.div`
35
+ display: flex;
36
+ margin: auto 10px auto 10px;
37
+ flex-direction: column;
38
+
39
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
40
+ margin: 10px 0 0 0;
41
+ flex-flow: row wrap;
42
+ }
43
+
44
+ ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
45
+ margin: 10px 5px 0 0;
46
+ flex-direction: column;
47
+ }
48
+ `
49
+ const StyledButton = styled(Button)`
50
+ margin: 2px 0 2px 0;
51
+ font-size: 0.8em !important;
52
+ padding: 1px 5px;
53
+
54
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
55
+ margin: 2px 5px 2px 0;
56
+ width: fit-content;
57
+ }
58
+
59
+ ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
60
+ margin: 2px 0 2px 0;
61
+ width: 100%;
62
+ max-width: 200px;
63
+ }
64
+ `
65
+
66
+ const StyledDate = styled.div`
67
+ text-align: left;
68
+ width: 15%;
69
+ `
70
+ const IconButtonWrapper = styled(Button)`
71
+ -webkit-box-align: center;
72
+ align-items: center;
73
+ -webkit-box-pack: center;
74
+ justify-content: center;
75
+ margin-right: 0.5rem;
76
+ display: inline-block !important;
77
+ margin-left: 0.5rem;
78
+ width: auto;
79
+ `
80
+ const IconWrapper = styled.div`
81
+ margin-left: 0.5rem;
82
+ display: inline-block;
83
+ `
84
+
85
+ const DiagnosisSummary: FC<Props> = ({
86
+ condition,
87
+ extendedTemplateDisplayName,
88
+ extensionTemplateDisplayName,
89
+ extensionClickHandler,
90
+ isReadOnly = false,
91
+ dateOnlyView = false,
92
+ canExtendDiagnosis = false,
93
+ controls = [],
94
+ ...rest
95
+ }) => {
96
+ if (condition.metadata.isRedacted) {
97
+ return (
98
+ <StyledSummary {...rest}>
99
+ <Redacted condition={condition} />
100
+ </StyledSummary>
101
+ )
102
+ }
103
+
104
+ const enteredInError = condition.verificationStatus === ConditionVerificationStatus.EnteredInError
105
+
106
+ return (
107
+ <StyledSummary {...rest}>
108
+ <StyledLeftContainer>
109
+ <StyledDescription>
110
+ <StyledTitle>
111
+ <Title enteredInError={enteredInError} condition={condition} />
112
+ </StyledTitle>
113
+ {extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && (
114
+ <IconButtonWrapper
115
+ onClick={extensionClickHandler}
116
+ type="button"
117
+ styling={{ buttonStyle: 'clear' }}
118
+ value=""
119
+ icon={<Icon type="folder-plus" size="medium" />}
120
+ iconPlacement="center"
121
+ iconColour={BTN_COLOURS.PRIMARY.VALUE}
122
+ title={`This diagnosis can be extended further using form '${extensionTemplateDisplayName}' by clicking here`}
123
+ />
124
+ )}
125
+ {extendedTemplateDisplayName && (
126
+ <IconWrapper>
127
+ <Icon
128
+ type="comment"
129
+ size="medium"
130
+ title={`This diagnosis has been extended beyond standard diagnosis with form '${extendedTemplateDisplayName}'.
131
+ To view these extra details, click into the full diagnosis detail or edit the existing form.`}
132
+ />
133
+ </IconWrapper>
134
+ )}
135
+ <Category enteredInError={enteredInError} condition={condition} />
136
+ </StyledDescription>
137
+
138
+ {!isReadOnly && controls.length > 0 && (
139
+ <StyledControlsContainer>
140
+ {controls.map((props, index) => (
141
+ <StyledButton key={index} {...props} />
142
+ ))}
143
+ </StyledControlsContainer>
144
+ )}
145
+ </StyledLeftContainer>
146
+ <StyledDate>
147
+ <DateSummary enteredInError={enteredInError} datetime={condition?.assertedDate} dateOnlyView={dateOnlyView} />
148
+ <OnsetDateEstimated enteredInError={enteredInError} condition={condition} />
149
+ </StyledDate>
150
+ </StyledSummary>
151
+ )
152
+ }
153
+
154
+ interface Props extends HTMLAttributes<HTMLDivElement> {
155
+ condition: Condition
156
+ extendedTemplateDisplayName?: string | undefined
157
+ extensionTemplateDisplayName?: string | undefined
158
+ extensionClickHandler?(): void
159
+ isReadOnly: boolean
160
+ dateOnlyView?: boolean
161
+ controls?: ButtonProps[]
162
+ canExtendDiagnosis?: boolean
163
+ }
164
+
165
+ export default DiagnosisSummary