Skip to content

Commit

Permalink
feat: append loading on the location attribute combobox
Browse files Browse the repository at this point in the history
  • Loading branch information
usamaidrsk committed Oct 22, 2024
1 parent 2f73d02 commit 83d841b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@
position: relative;

.loadingContainer {
background-color: colors.$white;
position: absolute;
right: -6rem;
bottom: 0;
right: layout.$spacing-07;
bottom: layout.$spacing-02;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import styles from './../field.scss';
import { useLocations } from './location-person-attribute-field.resource';
import { ComboBox, InlineLoading, Layer } from '@carbon/react';
import { useTranslation } from 'react-i18next';
import { isDesktop, useLayoutType } from '@openmrs/esm-framework';

export interface LocationPersonAttributeFieldProps {
id: string;
Expand All @@ -24,7 +23,6 @@ export function LocationPersonAttributeField({
required,
}: LocationPersonAttributeFieldProps) {
const { t } = useTranslation();
const isTablet = !isDesktop(useLayoutType());
const fieldName = `attributes.${personAttributeType.uuid}`;
const [field, meta, { setValue }] = useField(`attributes.${personAttributeType.uuid}`);
const [searchQuery, setSearchQuery] = useState<string>('');
Expand Down Expand Up @@ -76,7 +74,6 @@ export function LocationPersonAttributeField({
return (
<div
className={classNames(styles.customField, styles.halfWidthInDesktopView, styles.locationAttributeFieldContainer)}>
{loadingNewData && isTablet && <InlineLoading description="Loading..." />}
<Layer>
<Field name={fieldName}>
{({ field, form: { touched, errors } }) => {
Expand All @@ -98,9 +95,9 @@ export function LocationPersonAttributeField({
}}
</Field>
</Layer>
{loadingNewData && !isTablet && (
{loadingNewData && (
<div className={styles.loadingContainer}>
<InlineLoading description="Loading..." />
<InlineLoading />
</div>
)}
</div>
Expand Down

0 comments on commit 83d841b

Please sign in to comment.