Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jabahum committed Oct 15, 2024
1 parent 2ca3de5 commit 6f307c9
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 52 deletions.
26 changes: 26 additions & 0 deletions src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,30 @@ export const configSchema = {
_description: "Alt text, shown on hover",
},
},
loginBackgroundUrl: {
src: {
_type: Type.String,
_description:
"A path or URL to an image. If null, will use the OpenMRS SVG sprite.",
_validators: [validators.isUrl],
},
alt: {
_type: Type.String,
_default: "Background",
_description: "Alt text, shown on hover",
},
},
loginLogoUrl: {
src: {
_type: Type.String,
_description:
"A path or URL to an image. If null, will use the OpenMRS SVG sprite.",
_validators: [validators.isUrl],
},
alt: {
_type: Type.String,
_default: "OpenMRS Logo",
_description: "Alt text, shown on hover",
},
},
};
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getAsyncLifecycle, defineConfigSchema } from "@openmrs/esm-framework";
import { configSchema } from "./config-schema";
import { configSchema } from "./config-schema";

const moduleName = "@ugandaemr/esm-login-app";

Expand Down
22 changes: 22 additions & 0 deletions src/login/login.background.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { type ConfigSchema, useConfig } from "@openmrs/esm-framework";
import React from "react";

const LoginBackground = () => {
const { loginBackgroundUrl } = useConfig();

return loginBackgroundUrl.src ? (
<img
src={loginBackgroundUrl.src}
alt={loginBackgroundUrl.alt}
title="UgandaEMR+ Background"
/>
) : (
<img
src="/assets/background.png"
alt="UgandaEMR+ Background"
title="UgandaEMR+ Background"
/>
);
};

export default LoginBackground;
1 change: 0 additions & 1 deletion src/login/login.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ const Login: React.FC<LoginReferrer> = () => {
</div>
);
}

return null;
};

Expand Down
5 changes: 0 additions & 5 deletions src/login/login.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ jest.mock("./login.resource", () => ({
performLogin: jest.fn(),
}));

const loginLocations = [
{ uuid: "111", display: "Earth" },
{ uuid: "222", display: "Mars" },
];

mockedUseSession.mockReturnValue({ authenticated: false });
mockedUseConfig.mockReturnValue(mockConfig);

Expand Down
Loading

0 comments on commit 6f307c9

Please sign in to comment.