Skip to content
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

Adding metrics widgets to metrics extension slot(WIP) #183

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { Tile, Layer } from '@carbon/react';
import styles from './home-metrics-widget.scss';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can seperate the styles or have a single file that will insinuate that its used by many files

import { ArrowRight } from '@carbon/react/icons';

interface DataTileProps {}

const DataTile = () => {
const dataValue = 'default';
return (
<React.Fragment>
<Layer className={styles.container}>
<Tile className={styles.tileContainer}>
<div>
<h2>Data to display: {dataValue}</h2>
</div>
arodidev marked this conversation as resolved.
Show resolved Hide resolved
</Tile>
</Layer>
</React.Fragment>
);
};

export default DataTile;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use '@carbon/styles/scss/spacing';

.homeMetricsWidget {
padding: spacing.$spacing-05
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ExtensionSlot } from '@openmrs/esm-framework';
import React from 'react';
import styles from './home-metrics-widget.scss';

interface HomeMetricsWidgetProps {}

const HomeMetricsWidgets: React.FC<HomeMetricsWidgetProps> = () => {
return <ExtensionSlot className={styles.homeMetricsWidget} name="home-metrics-widgets-slot" />;
};

export default HomeMetricsWidgets;
Empty file.
6 changes: 6 additions & 0 deletions packages/esm-home-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { esmHomeSchema } from './openmrs-esm-home-schema';
import rootComponent from './root.component';
import homeNavMenuComponent from './side-menu/side-menu.component';
import homeWidgetDashboardComponent from './home-page-widgets/home-page-widgets.component';
import HomeMetricsWidgetsComponent from './homepage-metrics/home-metrics-widgets.component';
import DataTile from './homepage-metrics/TestDataTile.component';

const moduleName = '@openmrs/esm-home-app';
const pageName = 'home';
Expand All @@ -24,6 +26,10 @@ export const homeWidgetDbLink = getSyncLifecycle(createDashboardLink(dashboardMe

export const homeWidgetDashboard = getSyncLifecycle(homeWidgetDashboardComponent, options);

export const homeMetricsWidgetDashboard = getSyncLifecycle(HomeMetricsWidgetsComponent, options);

export const metricTile = getSyncLifecycle(DataTile, options);

export function startupApp() {
defineConfigSchema(moduleName, esmHomeSchema);
// t('Home', 'Home');
Expand Down
14 changes: 14 additions & 0 deletions packages/esm-home-app/src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,26 @@
"online": true,
"offline": true
},
{
"name": "home-metrics-widget-dashboard",
"slot": "home-dashboard-slot",
"component": "homeMetricsWidgetDashboard",
"online": true,
"offline": true
},
{
"name": "home-widget-dashboard",
"slot": "home-dashboard-slot",
"component": "homeWidgetDashboard",
"online": true,
"offline": true
},
{
"name": "matric-tile",
"slot": "home-metrics-widgets-slot",
"component": "metricTile",
"online": true,
"offline": true
}
]
}
Loading