-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) Patient lists UI fixes and improvements
- Loading branch information
1 parent
b0604ed
commit ae8b600
Showing
26 changed files
with
566 additions
and
415 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
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
51 changes: 51 additions & 0 deletions
51
packages/esm-patient-list-app/src/header/header.component.tsx
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,51 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Button } from '@carbon/react'; | ||
import { Add, Calendar } from '@carbon/react/icons'; | ||
import { formatDate, navigate } from '@openmrs/esm-framework'; | ||
import Illustration from '../illo'; | ||
import styles from './header.scss'; | ||
|
||
const Header: React.FC = () => { | ||
const { t } = useTranslation(); | ||
const newCohortUrl = window.getOpenmrsSpaBase() + 'home/patient-lists?new_cohort=true'; | ||
|
||
const handleShowNewListOverlay = () => { | ||
// URL navigation is in place to know either to open the create list overlay or not | ||
// The url /patient-list?new_cohort=true is being used in the "Add patient to list" widget | ||
// in the patient chart. The button in the above mentioned widget "Create new list", navigates | ||
// to /patient-list?new_cohort=true to open the overlay directly. | ||
navigate({ | ||
to: newCohortUrl, | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className={styles.patientListHeader}> | ||
<div className={styles.leftJustifiedItems}> | ||
<Illustration /> | ||
<div className={styles.pageLabels}> | ||
<p>{t('patientLists', 'Patient lists')}</p> | ||
<p className={styles.pageName}>{t('home', 'Home')}</p> | ||
</div> | ||
</div> | ||
<div className={styles.rightJustifiedItems}> | ||
<div className={styles.date}> | ||
<Calendar size={16} /> | ||
<span className={styles.value}>{formatDate(new Date(), { mode: 'standard' })}</span> | ||
</div> | ||
<Button | ||
className={styles.newListButton} | ||
kind="ghost" | ||
iconDescription="Add" | ||
renderIcon={(props) => <Add {...props} size={16} />} | ||
onClick={handleShowNewListOverlay} | ||
size="sm"> | ||
{t('newList', 'New list')} | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Header; |
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,52 @@ | ||
@use '@carbon/styles/scss/spacing'; | ||
@use '@carbon/styles/scss/type'; | ||
@import '../style.scss'; | ||
|
||
.patientListHeader { | ||
@include type.type-style('body-compact-02'); | ||
color: $text-02; | ||
height: spacing.$spacing-12; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.leftJustifiedItems { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
} | ||
|
||
.rightJustifiedItems { | ||
@include type.type-style('body-compact-02'); | ||
display: flex; | ||
flex-direction: column; | ||
color: $text-02; | ||
padding: 1rem 0; | ||
justify-content: space-between; | ||
} | ||
|
||
.date { | ||
display: flex; | ||
justify-content: flex-end; | ||
align-items: center; | ||
margin-right: 1rem; | ||
|
||
svg { | ||
margin-right: 0.5rem; | ||
} | ||
} | ||
|
||
.pageName { | ||
@include type.type-style('heading-04'); | ||
} | ||
|
||
.pageLabels { | ||
p:first-of-type { | ||
margin-bottom: 0.25rem; | ||
} | ||
} | ||
|
||
.newListButton { | ||
align-self: flex-end; | ||
width: fit-content; | ||
} |
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
Oops, something went wrong.