-
Notifications
You must be signed in to change notification settings - Fork 308
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
chore: hide table rows while results are loading #6089
chore: hide table rows while results are loading #6089
Conversation
|
packages/react-storage/src/components/StorageBrowser/components/Table.tsx
Outdated
Show resolved
Hide resolved
packages/react-storage/src/components/StorageBrowser/components/LoadingIndicator.tsx
Outdated
Show resolved
Hide resolved
const mappedRows = rows.map(({ key, content }) => ({ | ||
key, | ||
content: content.map(({ key, content, type }) => { | ||
switch (type) { | ||
case 'button': { | ||
return { | ||
key, | ||
content: <ButtonDataCell content={content} />, | ||
}; | ||
} | ||
case 'checkbox': { | ||
return { | ||
key, | ||
content: <CheckboxDataCell content={content} />, | ||
}; | ||
} | ||
case 'date': { | ||
return { | ||
key, | ||
content: <DateDataCell content={content} />, | ||
}; | ||
} | ||
case 'number': { | ||
return { | ||
key, | ||
content: <NumberDataCell content={content} />, | ||
}; | ||
} | ||
case 'text': | ||
default: { | ||
return { | ||
key, | ||
content: <TextDataCell content={content} />, | ||
}; | ||
} | ||
} | ||
}), | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no change to this section, it is just wrapped in conditional logic
className={`${STORAGE_BROWSER_BLOCK}__loading-indicator-text`} | ||
aria-live="polite" | ||
> | ||
Loading |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be provided as a prop so it can handled by display text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to be provided as a prop, passing in existing DEFAULT_LIST_VIEW_DISPLAY_TEXT.loadingIndicatorLabel
return ( | ||
<ViewElement className={`${STORAGE_BROWSER_BLOCK}__table-wrapper`}> | ||
<Table headers={mappedHeaders} rows={mappedRows} /> | ||
{!!isLoading && <LoadingIndicator />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer not to return false in JSX statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to return null instead
}), | ||
})); | ||
const mappedRows = !isLoading | ||
? rows.map(({ key, content }) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer early return of empty array for readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Updated
…rn empty array early
packages/react-storage/src/components/StorageBrowser/components/Table.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
...rc/components/StorageBrowser/views/LocationActionView/CopyView/__tests__/useCopyView.spec.ts
Fixed
Show fixed
Hide fixed
Moving to #6183 |
Description of changes
Issue #, if available
Description of how you validated changes
Checklist
yarn test
passes and tests are updated/addeddocs
,e2e
,examples
, or other private packages.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.