Skip to content

Commit

Permalink
(fix) O3 2804: Reuse the ResponsiveWrapper component from esm-framewo…
Browse files Browse the repository at this point in the history
…rk (openmrs#1673)

* (feat) Reuse ResponsiveWrapper component from esm-framework

* feat: Added Layer in visit-notes-form

* Fix styleguide imports by bumping both openmrs tooling and framework

* Misc fixes

---------

Co-authored-by: Dennis Kigen <[email protected]>
  • Loading branch information
2 people authored and usamaidrsk committed Mar 11, 2024
1 parent 8bc9cf0 commit 543c7d4
Show file tree
Hide file tree
Showing 101 changed files with 220 additions and 272 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.label01 {
@include type.type-style("label-01");
Expand Down Expand Up @@ -30,7 +30,7 @@
:global(.cds--cc--layout-row) {
height: 0;
}

:global(.layout-child) {
margin-top: spacing.$spacing-03;
}
Expand All @@ -45,15 +45,15 @@
.verticalTabs {
margin: 1rem 0;
scroll-behavior: smooth;

> ul {
flex-direction: column !important;
}

:global(.cds--tabs--scrollable .cds--tabs--scrollable__nav-item+.cds--tabs--scrollable__nav-item) {
margin-left: 0rem;
}

:global(.cds--tabs--scrollable .cds--tabs--scrollable__nav-link) {
border-bottom: 0 !important;
border-left: 2px solid $color-gray-30;
Expand Down Expand Up @@ -88,7 +88,7 @@
max-height: fit-content;
overflow-x: visible;
}

> button :global(.cds--tabs .cds--tabs__nav-link) {
border-bottom: none;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '@carbon/styles/scss/spacing';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.widgetContainer {
background-color: $ui-background;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.widgetCard {
border: 1px solid $ui-03;
}

.allergyCriticality {
display: flex;
align-items: center;
align-items: center;
text-transform: uppercase;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
FormGroup,
InlineLoading,
InlineNotification,
Layer,
RadioButton,
RadioButtonGroup,
Row,
Expand All @@ -28,6 +27,7 @@ import {
showToast,
useConfig,
useLayoutType,
ResponsiveWrapper,
} from '@openmrs/esm-framework';
import { type DefaultWorkspaceProps } from '@openmrs/esm-patient-common-lib';
import {
Expand Down Expand Up @@ -211,7 +211,7 @@ function AllergyForm(props: DefaultWorkspaceProps) {
)}
/>
)}
<ResponsiveWrapper isTablet={isTablet}>
<ResponsiveWrapper>
<FormGroup legendText={t('allergen', 'Allergen')} data-testid="allergens-container">
<Controller
name="allergen"
Expand All @@ -233,7 +233,7 @@ function AllergyForm(props: DefaultWorkspaceProps) {
</FormGroup>
</ResponsiveWrapper>
{selectedAllergen?.uuid === otherConceptUuid && (
<ResponsiveWrapper isTablet={isTablet}>
<ResponsiveWrapper>
<Controller
name="nonCodedAllergen"
control={control}
Expand Down Expand Up @@ -265,7 +265,7 @@ function AllergyForm(props: DefaultWorkspaceProps) {
</div>
{selectedAllergicReactions?.includes(otherConceptUuid) ? (
<div className={styles.input}>
<ResponsiveWrapper isTablet={isTablet}>
<ResponsiveWrapper>
<Controller
name="nonCodedAllergicReaction"
control={control}
Expand Down Expand Up @@ -322,7 +322,7 @@ function AllergyForm(props: DefaultWorkspaceProps) {
</FormGroup>
</div>
<div>
<ResponsiveWrapper isTablet={isTablet}>
<ResponsiveWrapper>
<Controller
name="comment"
control={control}
Expand Down Expand Up @@ -366,10 +366,6 @@ function AllergyForm(props: DefaultWorkspaceProps) {
);
}

function ResponsiveWrapper({ children, isTablet }: { children: React.ReactNode; isTablet: boolean }) {
return isTablet ? <Layer>{children} </Layer> : <>{children}</>;
}

function AllergicReactionsField({
allergicReactions,
methods: { control, setValue },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';
@import '../../root.scss';

.header {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.widgetCard {
border: 1px solid $ui-03;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.label {
@include type.type-style('label-01');
Expand All @@ -14,4 +14,4 @@

.value {
@include type.type-style('body-compact-01');
}
}
2 changes: 1 addition & 1 deletion packages/esm-patient-allergies-app/src/root.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.productiveHeading01 {
@include type.type-style("heading-compact-01");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use '@carbon/colors';
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

// TO DO Move this styles to style - guide
// https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-styleguide/src/_vars.scss
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.container {
margin: spacing.$spacing-05;
Expand All @@ -20,16 +20,16 @@
margin: 0rem 0rem;
}
}

.input {
margin: 0rem 1rem 1rem;
}

.headerLabel {
@include type.type-style('label-01');
color: $text-02;
}

.checkboxContainer {
display: grid;
grid-template-columns: 1fr 1fr;
Expand All @@ -44,4 +44,4 @@
width: 100%;
max-width: unset;
padding: '0rem';
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '@carbon/styles/scss/spacing';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';
@import '../root.scss';

.cameraSection {
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-patient-attachments-app/src/root.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.productiveHeading02 {
@include type.type-style("heading-compact-02");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use '@carbon/colors';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.container {
border-top: 0.063rem solid $ui-03;
Expand All @@ -18,11 +18,11 @@
.patientName {
color: $ui-01;
}

.demographics, .row, .identifierTag, .identifier, .contactDetails .heading {
color: $ui-02;
}

.toggleContactDetailsButton, .toggleContactDetailsButton > svg, .actionsButtonText {
color: colors.$blue-40;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

@mixin container{
color: $text-02;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '@carbon/colors';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.container {
margin-top: -1.25rem;
Expand Down Expand Up @@ -36,4 +36,4 @@

.deceased {
color: colors.$blue-40;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { useTranslation } from 'react-i18next';
import classNames from 'classnames';
import debounce from 'lodash-es/debounce';
import isEmpty from 'lodash-es/isEmpty';
import { Layer, RadioButton, RadioButtonGroup, Search } from '@carbon/react';
import { RadioButton, RadioButtonGroup, Search } from '@carbon/react';
import { EmptyState, PatientChartPagination } from '@openmrs/esm-patient-common-lib';
import { useLayoutType, usePagination } from '@openmrs/esm-framework';
import { useLayoutType, usePagination, ResponsiveWrapper } from '@openmrs/esm-framework';
import type { ConceptAnswer } from './deceased.resource';
import styles from './deceased-form.scss';

Expand Down Expand Up @@ -41,7 +41,7 @@ const BaseConceptAnswer: React.FC<BaseConceptAnswerProps> = ({ onChange, isPatie
isTablet ? styles.conceptAnswerOverviewWrapperTablet : styles.conceptAnswerOverviewWrapperDesktop,
)}
>
<ResponsiveWrapper isTablet={isTablet}>
<ResponsiveWrapper>
<Search
onChange={(event) => handleSearch(event.target.value)}
placeholder={t('searchForCauseOfDeath', 'Search for a cause of death')}
Expand Down Expand Up @@ -83,8 +83,4 @@ const BaseConceptAnswer: React.FC<BaseConceptAnswerProps> = ({ onChange, isPatie
);
};

function ResponsiveWrapper({ children, isTablet }: { children: React.ReactNode; isTablet: boolean }) {
return isTablet ? <Layer>{children} </Layer> : <>{children}</>;
}

export default BaseConceptAnswer;
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import {
DatePicker,
DatePickerInput,
Form,
Layer,
Row,
DatePickerSkeleton,
DataTableSkeleton,
} from '@carbon/react';
import { WarningFilled } from '@carbon/react/icons';
import { type DefaultWorkspaceProps } from '@openmrs/esm-patient-common-lib';
import { ExtensionSlot, useLayoutType, showSnackbar, showModal } from '@openmrs/esm-framework';
import { ExtensionSlot, useLayoutType, showSnackbar, showModal, ResponsiveWrapper } from '@openmrs/esm-framework';
import { markPatientDeceased, usePatientDeathConcepts, usePatientDeceased } from './deceased.resource';
import BaseConceptAnswer from './base-concept-answer.component';

Expand Down Expand Up @@ -85,7 +84,7 @@ const MarkPatientDeceasedForm: React.FC<DefaultWorkspaceProps> = ({ patientUuid,
{!conceptAnswers ? (
<DatePickerSkeleton />
) : (
<ResponsiveWrapper isTablet={isTablet}>
<ResponsiveWrapper>
<DatePicker
dateFormat="d/m/Y"
datePickerType="single"
Expand Down Expand Up @@ -141,8 +140,4 @@ const MarkPatientDeceasedForm: React.FC<DefaultWorkspaceProps> = ({ patientUuid,
);
};

function ResponsiveWrapper({ children, isTablet }: { children: React.ReactNode; isTablet: boolean }) {
return isTablet ? <Layer>{children} </Layer> : <>{children}</>;
}

export default MarkPatientDeceasedForm;
2 changes: 1 addition & 1 deletion packages/esm-patient-chart-app/src/loader/loader.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '@carbon/styles/scss/spacing';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.loading {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '@carbon/styles/scss/spacing';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

$icon-button-size: 2.5rem;
$actionPanelOffset: 3rem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';
@import "../../root.scss";

.dashboardTitle {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '@carbon/styles/scss/spacing';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

$actionNavOffset: 45px;
$actionPanelOffset: 256px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.container:after {
content: '';
Expand All @@ -20,5 +20,5 @@

.name {
@include type.type-style('body-compact-02');

}
2 changes: 1 addition & 1 deletion packages/esm-patient-chart-app/src/root.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

:root {
--bottom-nav-height: 4rem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '~@openmrs/esm-styleguide/src/vars';
@import '@openmrs/esm-styleguide/src/vars';

.headerGlobalBarCloseButton {
@include brand-02(background-color);
}
}
Loading

0 comments on commit 543c7d4

Please sign in to comment.