-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the tabs implementation in the commons-lib -cacx (#1894)
* Move the tabs implementation in the commons-lib -cacx * remove unused code * update the imported TabsComponent * address comments on the PR * pass the config at the package
- Loading branch information
1 parent
cc439af
commit a5b1671
Showing
4 changed files
with
47 additions
and
32 deletions.
There are no files selected for viewing
33 changes: 2 additions & 31 deletions
33
...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,16 @@ | ||
import React from 'react'; | ||
import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; | ||
import { TabsComponent } from '@ohri/openmrs-esm-ohri-commons-lib'; | ||
import { useConfig } from '@openmrs/esm-framework'; | ||
import { EncounterList, getMenuItemTabConfiguration } 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} config={config} />; | ||
}; | ||
|
||
export default CaCxCervicalCancerServices; |
43 changes: 43 additions & 0 deletions
43
...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,43 @@ | ||
import React from 'react'; | ||
import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; | ||
import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; | ||
import styles from './encounter-list-tabs.scss'; | ||
|
||
interface TabsComponentProps { | ||
patientUuid: string; | ||
configSchema: any; | ||
config: any; | ||
} | ||
|
||
export const TabsComponent: React.FC<TabsComponentProps> = ({ patientUuid, configSchema, config }) => { | ||
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