Skip to content

Commit

Permalink
Making the icon on the header configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Daphne210 committed Oct 14, 2023
1 parent a091c29 commit 8f3c276
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 29 deletions.
6 changes: 3 additions & 3 deletions src/components/header/home-header.component.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { Calendar, Location } from "@carbon/react/icons";
import { Calendar, Events, Location } from "@carbon/react/icons";
import { formatDate, useSession } from "@openmrs/esm-framework";
import { HomeIllustration } from "./home-illustration.component";
import styles from "./home-header.scss";
Expand All @@ -26,15 +26,15 @@ export const HomeHeader: React.FC<HomeHeaderProps> = ({
<>
<div className={styles.header}>
<div className={styles["left-justified-items"]}>
<HomeIllustration />
<HomeIllustration icon={<Events />} />
<div className={styles["page-labels"]}>
<p>{t("home", "Home")}</p>
<p className={styles["page-name"]}>{headerTitle}</p>
</div>
</div>
<div className={styles["right-justified-items"]}>
<div className={styles["date-and-location"]}>
{icon}
<Location size={16} />
<span className={styles.value}>{userLocation}</span>
<span className={styles.middot}>&middot;</span>
<Calendar size={16} />
Expand Down
12 changes: 12 additions & 0 deletions src/components/header/home-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,15 @@
left: -10.15rem;
}
}

svg.iconOverrides {
width: 72px !important;
height: 72px !important;
fill: var(--brand-03);
}

.svgContainer svg {
width: 72px;
height: 72px;
fill: var(--brand-03);
}
35 changes: 9 additions & 26 deletions src/components/header/home-illustration.component.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
import React from "react";
import styles from "./home-header.scss";

export const HomeIllustration: React.FC = () => {
return (
<svg
width="100"
height="72"
viewBox="0 0 250 250"
xmlns="http://www.w3.org/2000/svg"
>
<g>
<g>
<g>
<path
fill="#7BBCB9"
data-title="Layer 0"
d="M24.1,116.2v106.2h89.7h89.7V116.2V10h-89.7H24.1V116.2L24.1,116.2z M137.1,44.7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H61.8v-4.7v-4.7h-4.7h-4.7v9.4v9.4h89.4h89.4v-38.5c0-21.1,0.2-68.9,0.4-106.2l0.4-67.7h-11.9h-11.9V38.3z"
/>
</g>
</g>
</g>
</svg>
);
export interface HomeIllustrationProps {
icon: React.ReactNode;
}

export const HomeIllustration: React.FC<HomeIllustrationProps> = ({ icon }) => {
return <div className={styles.svgContainer}>{icon}</div>;
};

export default HomeIllustration;

0 comments on commit 8f3c276

Please sign in to comment.