-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
161 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
$ui-01: #f4f4f4; | ||
$ui-02: #ffffff; | ||
$ui-03: #e0e0e0; | ||
$ui-04: #8d8d8d; | ||
$ui-05: #161616; | ||
$text-02: #525252; | ||
$text-03: #a8a8a8; | ||
$ui-background: #ffffff; | ||
$color-gray-30: #c6c6c6; | ||
$color-gray-70: #525252; | ||
$color-gray-100: #161616; | ||
$color-blue-60-2: #0f62fe; | ||
$color-blue-10: #edf5ff; | ||
$color-yellow-50: #feecae; | ||
$carbon--red-50: #fa4d56; | ||
$inverse-link: #78a9ff; | ||
$support-02: #24a148; | ||
$inverse-support-03: #f1c21b; | ||
$warning-background: #fff8e1; | ||
$openmrs-background-grey: #f4f4f4; | ||
$danger: #da1e28; | ||
$interactive-01: #0f62fe; | ||
$field-01: #f4f4f4; | ||
$grey-2: #e0e0e0; | ||
$labeldropdown: #c6c6c6; | ||
|
||
$breakpoint-phone-min: 0px; | ||
$breakpoint-phone-max: 600px; | ||
$breakpoint-tablet-min: 601px; | ||
$breakpoint-tablet-max: 1023px; | ||
$breakpoint-small-desktop-min: 1024px; | ||
$breakpoint-small-desktop-max: 1439px; | ||
$breakpoint-large-desktop-min: 1440px; | ||
$breakpoint-large-desktop-max: 99999999px; |
40 changes: 40 additions & 0 deletions
40
packages/esm-ohri-core-app/src/dashboard/side-menu/left-nav-menu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** @module @category UI */ | ||
import React from 'react'; | ||
import { ExtensionSlot, useStore } from '@openmrs/esm-react-utils'; | ||
import { createGlobalStore } from '@openmrs/esm-state'; | ||
import { SideNav, SideNavProps } from '@carbon/react'; | ||
import styles from './left-nav.module.scss'; | ||
|
||
interface LeftNavStore { | ||
slotName: string | null; | ||
basePath: string; | ||
} | ||
|
||
const leftNavStore = createGlobalStore<LeftNavStore>('left-nav', { | ||
slotName: null, | ||
basePath: window.spaBase, | ||
}); | ||
|
||
export function setLeftNav({ name, basePath }) { | ||
leftNavStore.setState({ slotName: name, basePath }); | ||
} | ||
|
||
export function unsetLeftNav(name) { | ||
if (leftNavStore.getState().slotName == name) { | ||
leftNavStore.setState({ slotName: null }); | ||
} | ||
} | ||
|
||
type LeftNavMenuProps = SideNavProps; | ||
|
||
export const LeftNavMenu = React.forwardRef<HTMLElement, LeftNavMenuProps>((props, ref) => { | ||
const { slotName, basePath } = useStore(leftNavStore); | ||
const currentPath = window.location ?? { pathname: '' }; | ||
|
||
return ( | ||
<SideNav ref={ref} expanded aria-label="Left navigation" className={styles.leftNav} {...props}> | ||
<ExtensionSlot name="global-nav-menu-slot" /> | ||
{slotName ? <ExtensionSlot name={slotName} state={{ basePath, currentPath }} /> : null} | ||
</SideNav> | ||
); | ||
}); |
41 changes: 41 additions & 0 deletions
41
packages/esm-ohri-core-app/src/dashboard/side-menu/left-nav.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@use "@carbon/styles/scss/type"; | ||
@import "../vars"; | ||
|
||
.leftNav { | ||
border-right: 1px solid $ui-03; | ||
padding-top: 1rem; | ||
|
||
// Left nav menu item | ||
:global(.cds--side-nav__link) { | ||
color: $text-02; | ||
@include type.type-style("heading-compact-01"); | ||
|
||
&:focus, | ||
&:hover { | ||
background-color: $ui-01; | ||
} | ||
|
||
// Active menu item | ||
&:global(.active-left-nav-link) { | ||
color: $ui-05; | ||
border-left: 0.25rem solid var(--brand-01); | ||
background-color: $ui-03; | ||
outline: none; | ||
padding: 0 0.75rem; | ||
} | ||
} | ||
} | ||
|
||
/* Desktop */ | ||
:global(.omrs-breakpoint-gt-tablet) { | ||
:global(.cds--side-nav__link) { | ||
height: 2rem; | ||
} | ||
} | ||
|
||
/* Tablet */ | ||
:global(.omrs-breakpoint-lt-desktop) { | ||
:global(.cds--side-nav__link) { | ||
height: 3rem; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...app/src/dashboard/side-menu.component.tsx → ...shboard/side-menu/side-menu.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters