-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move the tabs implementation in the commons-lib -cacx #1894
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6154c84
Move the tabs implementation in the commons-lib -cacx
lucyjemutai d43deae
remove unused code
lucyjemutai 1d53dcb
update the imported TabsComponent
lucyjemutai 0c48fab
Merge branch 'UCSF-IGHS:dev' into cacx-tabs
lucyjemutai ea169b5
address comments on the PR
lucyjemutai 8873b45
Merge branch 'UCSF-IGHS:dev' into cacx-tabs
lucyjemutai ee940b0
pass the config at the package
lucyjemutai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 2 additions & 34 deletions
36
...sm-cervical-cancer-app/src/cervical-cancer/cacx-visits/cacx-visits-services.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 |
---|---|---|
@@ -1,45 +1,13 @@ | ||
import React from 'react'; | ||
import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; | ||
import { useConfig } from '@openmrs/esm-framework'; | ||
import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; | ||
import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; | ||
import cacxConfigSchema from './cacx-config.json'; | ||
|
||
import styles from '../common.scss'; | ||
|
||
interface OverviewListProps { | ||
patientUuid: string; | ||
} | ||
|
||
const CaCxCervicalCancerServices: React.FC<OverviewListProps> = ({ patientUuid }) => { | ||
const config = useConfig(); | ||
const tabs = getMenuItemTabConfiguration(cacxConfigSchema, config); | ||
|
||
return ( | ||
<div className={styles.tabContainer}> | ||
<Tabs> | ||
<TabList contained> | ||
{tabs.map((tab) => ( | ||
<Tab key={tab.name}>{tab.name}</Tab> | ||
))} | ||
</TabList> | ||
<TabPanels> | ||
{tabs.map((tab) => ( | ||
<TabPanel> | ||
<EncounterList | ||
patientUuid={patientUuid} | ||
formList={tab.formList} | ||
columns={tab.columns} | ||
encounterType={tab.encounterType} | ||
launchOptions={tab.launchOptions} | ||
headerTitle={tab.headerTitle} | ||
description={tab.description} | ||
/> | ||
</TabPanel> | ||
))} | ||
</TabPanels> | ||
</Tabs> | ||
</div> | ||
); | ||
return <TabsComponent patientUuid={patientUuid} configSchema={cacxConfigSchema} />; | ||
}; | ||
|
||
export default CaCxCervicalCancerServices; |
44 changes: 44 additions & 0 deletions
44
...ages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.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,44 @@ | ||
import React from 'react'; | ||
import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; | ||
import { useConfig } from '@openmrs/esm-framework'; | ||
import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; | ||
import styles from './encounter-list-tabs.scss'; | ||
|
||
interface TabsComponentProps { | ||
patientUuid: string; | ||
configSchema: any; | ||
} | ||
|
||
export const TabsComponent: React.FC<TabsComponentProps> = ({ patientUuid, configSchema }) => { | ||
const config = useConfig(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will not work because at this point the config is for the commons lib, we need to pass the config at the package/app level since the configs are different across packages. |
||
const tabsConfig = getMenuItemTabConfiguration(configSchema, config); | ||
|
||
return ( | ||
<div className={styles.tabContainer}> | ||
<Tabs> | ||
<TabList contained> | ||
{tabsConfig.map((tab) => ( | ||
<Tab key={tab.name}>{tab.name}</Tab> | ||
))} | ||
</TabList> | ||
<TabPanels> | ||
{tabsConfig.map((tab) => ( | ||
<TabPanel key={tab.name}> | ||
<EncounterList | ||
patientUuid={patientUuid} | ||
formList={tab.formList} | ||
columns={tab.columns} | ||
encounterType={tab.encounterType} | ||
launchOptions={tab.launchOptions} | ||
headerTitle={tab.headerTitle} | ||
description={tab.description} | ||
/> | ||
</TabPanel> | ||
))} | ||
</TabPanels> | ||
</Tabs> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TabsComponent; |
2 changes: 1 addition & 1 deletion
2
...ancer-app/src/cervical-cancer/common.scss → ...ounter-list-tabs/encounter-list-tabs.scss
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package config should also be passed at this point