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

(feat) Anchor workspace actions to the bottom of the screen in tablet mode #1650

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import classNames from 'classnames';
import { ExtensionSlot } from '@openmrs/esm-framework';
import { ExtensionSlot, useLayoutType } from '@openmrs/esm-framework';
import styles from './action-menu.scss';

interface ActionMenuInterface {
Expand All @@ -10,7 +10,7 @@ interface ActionMenuInterface {
export const ActionMenu: React.FC<ActionMenuInterface> = ({ open }) => {
const [keyboardVisible, setKeyboardVisible] = useState(false);
const initialHeight = useRef(window.innerHeight);

const isTablet = useLayoutType() === 'tablet';
useEffect(() => {
Comment on lines +13 to 14
Copy link
Member

Choose a reason for hiding this comment

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

Would've been nice to keep the newline here...

const handleKeyboardVisibilityChange = () => {
setKeyboardVisible(initialHeight.current > window.innerHeight);
Expand All @@ -22,6 +22,10 @@ export const ActionMenu: React.FC<ActionMenuInterface> = ({ open }) => {
return () => window.removeEventListener('resize', handleKeyboardVisibilityChange);
}, [initialHeight]);

if (open && isTablet) {
return null;
}

return (
<aside
className={classNames(styles.sideRail, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const PatientChart: React.FC = () => {
</>
)}
</div>
<ActionMenu open={false} />
<ActionMenu open={active} />
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little confused on the logic here? The action menu is open if the workspace is active? It feels like we might've needed a different prop for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ibacher It seems I may have misinterpreted the original idea. The intention is to conceal the action menu on tablet devices when a workspace form is open, allowing for increased working space on smaller tablets. I will do a follow on PR to address it.

</>
</main>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@
margin: 0.5rem 1rem;
}

.form {
display: flex;
flex-direction: column;
justify-content: space-between;
height: calc(100vh - 6rem);
}

.button {
height: 4rem;
Expand All @@ -58,8 +52,11 @@
}

.tablet {
padding: 1.5rem 1rem;
padding: 1rem;
background-color: $ui-02;
position: fixed;
bottom: 0rem;
width: 100%;
}

.desktop {
Expand Down Expand Up @@ -87,6 +84,17 @@
color: $text-02;
}

/* Desktop */
:global(.omrs-breakpoint-gt-tablet) {
.form {
display: flex;
flex-direction: column;
justify-content: space-between;
height: calc(100vh - 6rem);
}
}

/* Tablet */
:global(.omrs-breakpoint-lt-desktop) {
.container {
& section {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@
}

.tablet {
padding: 1.5rem 1rem;
padding: 1rem;
background-color: $ui-02;
position: fixed;
bottom: 0rem;
width: 100%;
}

.desktop {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
.buttonSet {
padding: spacing.$spacing-06 spacing.$spacing-05;
background-color: $ui-02;
position: fixed;
bottom: 0;
width: 100%;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
}

.orderForm {
flex-grow:1;
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: layout.$spacing-03 0 0 layout.$spacing-05;


input[data-invalid]:focus {
outline: 2px solid colors.$red-60;
outline-offset: -2px;
outline: 2px solid colors.$red-60;
outline-offset: -2px;
}

:global(.cds--css-grid) {
Expand Down Expand Up @@ -101,7 +102,7 @@
margin-bottom: layout.$spacing-05;
}

.pullColumnContentRight > div {
.pullColumnContentRight>div {
float: right;
}

Expand All @@ -125,8 +126,8 @@

.numberInput {
:global(.cds--number__input-wrapper) input {
min-width: unset !important;
padding-right: layout.$spacing-05;
min-width: unset !important;
padding-right: layout.$spacing-05;
}
}

Expand All @@ -138,7 +139,8 @@

button {
display: flex;
padding-left: 0 !important;
padding-left: 0 !important;

svg {
order: 1;
margin-right: layout.$spacing-03;
Expand Down Expand Up @@ -225,6 +227,9 @@
.buttonSet {
padding: layout.$spacing-06 layout.$spacing-05;
background-color: colors.$white-0;
position: fixed;
bottom: 0rem;
width: 100%;
}
}

Expand All @@ -233,12 +238,12 @@
outline: 2.5px solid colors.$red-60;
}

input:focus, textarea:focus {
input:focus,
textarea:focus {
outline: 2.5px solid colors.$red-60;
}
}

.errorLabel {
color: colors.$red-60;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@
}

.tablet {
padding: 1.5rem 1rem;
padding: 1rem 1rem;
background-color: $ui-02;
position: fixed;
bottom: 0rem;
width: 100%;
}

.desktop {
Expand All @@ -93,7 +96,7 @@
display: flex;
flex-direction: column;
justify-content: space-between;
height: var(--desktop-workspace-window-height);
// height: var(--desktop-workspace-window-height);
Comment on lines -96 to +99
Copy link
Member

Choose a reason for hiding this comment

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

Can we fix this, since this has been merged?

}

.grid {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@
.buttonSet {
padding: 1.5rem 1rem;
background-color: $ui-02;
position: fixed;
bottom: 0rem;
width: 100%;
}
}
Loading