generated from openmrs/openmrs-esm-template-app
-
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.
(feat) O3-3241 : User onboarding for patient registration (#9)
* feat : added tutorials for patient registration * Navigate all tutorials to home page * handle steps for multi pages * Add Register Patient step * Modify the unit test for modal according to navigation * Add custom tooltip and updatesd the styles * Add patient tutorial * Remove unwanted steps
- Loading branch information
Showing
7 changed files
with
262 additions
and
44 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
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,68 @@ | ||
import React from 'react'; | ||
import { Button } from '@carbon/react'; | ||
import { ArrowLeft, ArrowRight } from '@carbon/react/icons'; | ||
import { useTranslation } from 'react-i18next'; | ||
import styles from './tooltip.scss'; | ||
|
||
interface CustomTooltipProps { | ||
continuous: boolean; | ||
index: number; | ||
step: any; | ||
backProps: any; | ||
closeProps: any; | ||
primaryProps: any; | ||
tooltipProps: any; | ||
totalSteps: number; | ||
} | ||
|
||
const CustomTooltip: React.FC<CustomTooltipProps> = ({ | ||
continuous, | ||
index, | ||
step, | ||
backProps, | ||
primaryProps, | ||
tooltipProps, | ||
totalSteps, | ||
}) => { | ||
const { t } = useTranslation(); | ||
const isLastStep = index === totalSteps - 1; | ||
|
||
return ( | ||
<div {...tooltipProps} className={styles.tooltipcontainer}> | ||
<div className={styles.tooltipheader}> | ||
<h4 className={styles.tooltiptitle}>{step.title}</h4> | ||
<span className={styles.tooltipstep}>{`${index + 1}/${totalSteps}`}</span> | ||
</div> | ||
<div className={styles.tooltipcontent}>{step.content}</div> | ||
<div className={styles.tooltipfooter}> | ||
{!step.hideBackButton && index > 0 && ( | ||
<div {...backProps} size="sm" className={styles.buttonback}> | ||
<ArrowLeft style={{ marginRight: '8px' }} /> | ||
{t('back', 'Back')} | ||
</div> | ||
)} | ||
{continuous && !step.hideNextButton && ( | ||
<Button {...primaryProps} size="sm" className={styles.buttonnext}> | ||
{isLastStep ? ( | ||
<> | ||
{t('finish', 'Finish')} | ||
<div className={styles.arrowContainer}> | ||
<ArrowRight /> | ||
</div> | ||
</> | ||
) : ( | ||
<> | ||
{t('next', 'Next')} | ||
<div className={styles.arrowContainer}> | ||
<ArrowRight /> | ||
</div> | ||
</> | ||
)} | ||
</Button> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CustomTooltip; |
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,54 @@ | ||
@use '@carbon/styles/scss/spacing'; | ||
@use '@carbon/styles/scss/type'; | ||
@import '~@openmrs/esm-styleguide/src/vars'; | ||
|
||
.tooltipcontainer { | ||
background-color: $ui-02; | ||
padding: spacing.$spacing-05; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
max-width: 360px; | ||
border-radius: spacing.$spacing-02; | ||
gap: spacing.$spacing-04; | ||
background-color: $ui-02; | ||
|
||
.tooltipheader { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin-bottom: spacing.$spacing-01; | ||
.tooltiptitle { | ||
@include type.type-style('heading-02'); | ||
} | ||
.tooltipstep { | ||
color: $color-gray-70; | ||
@include type.type-style('body-compact-01'); | ||
} | ||
} | ||
|
||
.tooltipcontent { | ||
color: $color-gray-70; | ||
@include type.type-style('body-compact-01'); | ||
} | ||
|
||
.tooltipfooter { | ||
margin-top: spacing.$spacing-06; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
.buttonback { | ||
color: $color-blue-60-2; | ||
display: flex; | ||
align-items: center; | ||
} | ||
.buttonnext { | ||
margin-left: auto; | ||
width:spacing.$spacing-12; | ||
.arrowContainer { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin-left: spacing.$spacing-05; | ||
} | ||
} | ||
} | ||
} |
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.