diff --git a/packages/esm-cervical-cancer-app/src/cervical-cancer/cacx-visits/cacx-visits-services.component.tsx b/packages/esm-cervical-cancer-app/src/cervical-cancer/cacx-visits/cacx-visits-services.component.tsx index 29039051a..a86391ba1 100644 --- a/packages/esm-cervical-cancer-app/src/cervical-cancer/cacx-visits/cacx-visits-services.component.tsx +++ b/packages/esm-cervical-cancer-app/src/cervical-cancer/cacx-visits/cacx-visits-services.component.tsx @@ -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 = ({ patientUuid }) => { const config = useConfig(); - const tabs = getMenuItemTabConfiguration(cacxConfigSchema, config); - return ( -
- - - {tabs.map((tab) => ( - {tab.name} - ))} - - - {tabs.map((tab) => ( - - - - ))} - - -
- ); + return ; }; export default CaCxCervicalCancerServices; diff --git a/packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.component.tsx b/packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.component.tsx new file mode 100644 index 000000000..e53722bed --- /dev/null +++ b/packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.component.tsx @@ -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 = ({ patientUuid, configSchema, config }) => { + const tabsConfig = getMenuItemTabConfiguration(configSchema, config); + + return ( +
+ + + {tabsConfig.map((tab) => ( + {tab.name} + ))} + + + {tabsConfig.map((tab) => ( + + + + ))} + + +
+ ); +}; + +export default TabsComponent; diff --git a/packages/esm-cervical-cancer-app/src/cervical-cancer/common.scss b/packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.scss similarity index 85% rename from packages/esm-cervical-cancer-app/src/cervical-cancer/common.scss rename to packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.scss index 831f26422..b68754591 100644 --- a/packages/esm-cervical-cancer-app/src/cervical-cancer/common.scss +++ b/packages/esm-commons-lib/src/components/encounter-list-tabs/encounter-list-tabs.scss @@ -1,5 +1,5 @@ @use '@carbon/styles/scss/spacing'; -@import '../root.scss'; +@import '../../root.scss'; .tabContainer div[role='tabpanel'] { padding: 0 !important; diff --git a/packages/esm-commons-lib/src/index.ts b/packages/esm-commons-lib/src/index.ts index 25f3548f3..f4982ca46 100644 --- a/packages/esm-commons-lib/src/index.ts +++ b/packages/esm-commons-lib/src/index.ts @@ -55,6 +55,7 @@ export * from './utils/summary-card-config-builder'; export * from './utils/encounter-tile-config-builder'; export * from './utils/cohort-list-config-builder'; export * from './utils/patient-list-tabs-config-builder'; +export * from './components/encounter-list-tabs/encounter-list-tabs.component'; // Workspace registration moved to the index.ts and routes.json const options = { featureName: 'ohri-forms-workspace-item',