Skip to content

Commit

Permalink
A-1205100474888030 | Pass translations from angular to local react mi…
Browse files Browse the repository at this point in the history
…cro-frontend components (#646)

* add. passing of translations from angular to local micro-frontend

* add. wrapper component for handling translations
  • Loading branch information
Arjun-Go authored Jul 24, 2023
1 parent 2dca64b commit 2efd6d0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 27 additions & 1 deletion micro-frontends/src/next-ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,30 @@ angular.module(moduleName, []);

angular
.module(moduleName)
.component("mfeNextUiPatientAlergiesControl", react2angular(PatientAlergiesControl));
.component("mfeNextUiPatientAlergiesControlRemote", react2angular(PatientAlergiesControl));

function nextUIPatientAlergiesControlController ($scope, $translate) {
const vm = this;
$scope.hostData = vm.hostData;
$scope.hostApi = vm.hostApi;
$scope.translations = {
ipdDemoKey: $translate.instant("DASHBOARD_TAB_IPD_DEMO_KEY"),
};
}

nextUIPatientAlergiesControlController.$inject = ["$scope", "$translate"];

angular.module(moduleName).component("mfeNextUiPatientAlergiesControl", {
controller: nextUIPatientAlergiesControlController,
bindings: {
hostData: "=",
hostApi: "=",
},
template: `
<mfe-next-ui-patient-alergies-control-remote
host-data="hostData"
host-api="hostApi"
translations="translations"
></mfe-next-ui-patient-alergies-control-remote>
`,
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function PatientAlergiesControl(props) {
return (
<div>
<span>Displaying alergy control from {props.hostData.name}</span>
<span>Translation: {props.translations?.ipdDemoKey}</span>
<Button onClick={props.hostApi?.callback}>Click for callback</Button>
</div>
);
Expand All @@ -23,4 +24,5 @@ PatientAlergiesControl.propTypes = {
hostApi: PropTypes.shape({
callback: PropTypes.func.isRequired,
}),
translations: PropTypes.object.isRequired,
};

0 comments on commit 2efd6d0

Please sign in to comment.