-
Couldn't load subscription status.
- Fork 4
Da/config loading #650
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
Merged
Merged
Da/config loading #650
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
92a122a
feat: normalizing loading behavior on calculate
dmortal 209a020
chore: adding loading indicator to overview component
dmortal 7c78b36
chore: fixing tests
dmortal cb91d77
chore: remove runpayrollflow from export
dmortal cd5f7a3
feat: adding LoadingSpinner component
dmortal 9ea0467
Update src/components/Payroll/usePreparedPayrollData.ts
dmortal cca5149
chore: cleanup
dmortal aa4938c
Merge remote-tracking branch 'origin/main' into da/configLoading
dmortal c154fce
chore: merge origin
dmortal 0a32255
fix: linting
dmortal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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 hidden or 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
40 changes: 40 additions & 0 deletions
40
src/components/Common/UI/LoadingSpinner/LoadingSpinner.module.scss
This file contains hidden or 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 @@ | ||
| @keyframes spin { | ||
| from { | ||
| transform: rotate(0deg); | ||
| } | ||
| to { | ||
| transform: rotate(360deg); | ||
| } | ||
| } | ||
|
|
||
| .loadingSpinner { | ||
| align-items: center; | ||
| justify-content: center; | ||
|
|
||
| .spinnerIcon { | ||
| animation: spin 1s linear infinite; | ||
| color: var(--g-colorPrimary); | ||
| } | ||
|
|
||
| &[data-style='inline'] { | ||
| display: inline-flex; | ||
| } | ||
|
|
||
| &[data-style='block'] { | ||
| display: flex; | ||
| } | ||
|
|
||
| &[data-size='lg'] { | ||
| .spinnerIcon { | ||
| width: toRem(80); | ||
| height: toRem(80); | ||
| } | ||
| } | ||
|
|
||
| &[data-size='sm'] { | ||
| .spinnerIcon { | ||
| width: toRem(20); | ||
| height: toRem(20); | ||
| } | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
src/components/Common/UI/LoadingSpinner/LoadingSpinner.stories.tsx
This file contains hidden or 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 @@ | ||
| import type { Story } from '@ladle/react' | ||
| import type { LoadingSpinnerProps } from './LoadingSpinnerTypes' | ||
| import { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext' | ||
|
|
||
| const LoadingSpinnerWrapper = (props: LoadingSpinnerProps) => { | ||
| const Components = useComponentContext() | ||
| return <Components.LoadingSpinner {...props} /> | ||
| } | ||
|
|
||
| export default { | ||
| title: 'UI/Components/LoadingSpinner', | ||
| component: LoadingSpinnerWrapper, | ||
| } | ||
|
|
||
| export const Large: Story<LoadingSpinnerProps> = args => <LoadingSpinnerWrapper {...args} /> | ||
| Large.args = { | ||
| size: 'lg', | ||
| style: 'block', | ||
| } | ||
|
|
||
| export const Small: Story<LoadingSpinnerProps> = args => <LoadingSpinnerWrapper {...args} /> | ||
| Small.args = { | ||
| size: 'sm', | ||
| style: 'block', | ||
| } | ||
|
|
||
| export const Inline: Story<LoadingSpinnerProps> = args => ( | ||
| <div> | ||
| Loading <LoadingSpinnerWrapper {...args} /> please wait... | ||
| </div> | ||
| ) | ||
| Inline.args = { | ||
| size: 'sm', | ||
| style: 'inline', | ||
| } | ||
|
|
||
| export const Block: Story<LoadingSpinnerProps> = args => <LoadingSpinnerWrapper {...args} /> | ||
| Block.args = { | ||
| size: 'lg', | ||
| style: 'block', | ||
| } |
34 changes: 34 additions & 0 deletions
34
src/components/Common/UI/LoadingSpinner/LoadingSpinner.test.tsx
This file contains hidden or 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 @@ | ||
| import { describe, it } from 'vitest' | ||
| import { LoadingSpinner } from './LoadingSpinner' | ||
| import { renderWithProviders } from '@/test-utils/renderWithProviders' | ||
|
|
||
| describe('LoadingSpinner', () => { | ||
| describe('Accessibility', () => { | ||
| const testCases = [ | ||
| { | ||
| name: 'large spinner', | ||
| props: { size: 'lg' as const }, | ||
| }, | ||
| { | ||
| name: 'small spinner', | ||
| props: { size: 'sm' as const }, | ||
| }, | ||
| { | ||
| name: 'inline spinner', | ||
| props: { style: 'inline' as const }, | ||
| }, | ||
| { | ||
| name: 'block spinner', | ||
| props: { style: 'block' as const }, | ||
| }, | ||
| ] | ||
|
|
||
| it.each(testCases)( | ||
| 'should not have any accessibility violations - $name', | ||
| async ({ props }) => { | ||
| const { container } = renderWithProviders(<LoadingSpinner {...props} />) | ||
| await expectNoAxeViolations(container) | ||
| }, | ||
| ) | ||
| }) | ||
| }) |
25 changes: 25 additions & 0 deletions
25
src/components/Common/UI/LoadingSpinner/LoadingSpinner.tsx
This file contains hidden or 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,25 @@ | ||
| import type React from 'react' | ||
| import classnames from 'classnames' | ||
| import styles from './LoadingSpinner.module.scss' | ||
| import type { LoadingSpinnerProps } from './LoadingSpinnerTypes' | ||
| import { LoadingSpinnerDefaults } from './LoadingSpinnerTypes' | ||
| import { applyMissingDefaults } from '@/helpers/applyMissingDefaults' | ||
| import SpinnerIcon from '@/assets/icons/spinner_large.svg?react' | ||
|
|
||
| export const LoadingSpinner: React.FC<LoadingSpinnerProps> = rawProps => { | ||
| const resolvedProps = applyMissingDefaults(rawProps, LoadingSpinnerDefaults) | ||
| const { className, size, style, ...otherProps } = resolvedProps | ||
|
|
||
| return ( | ||
| <div | ||
| {...otherProps} | ||
| className={classnames(styles.loadingSpinner, className)} | ||
| data-size={size} | ||
| data-style={style} | ||
| role="status" | ||
| aria-label={otherProps['aria-label'] || 'Loading'} | ||
| > | ||
| <SpinnerIcon className={styles.spinnerIcon} aria-hidden="true" /> | ||
| </div> | ||
| ) | ||
| } |
21 changes: 21 additions & 0 deletions
21
src/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes.ts
This file contains hidden or 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,21 @@ | ||
| import type { HTMLAttributes } from 'react' | ||
|
|
||
| export interface LoadingSpinnerProps | ||
| extends Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'id' | 'aria-label'> { | ||
| /** | ||
| * Size of the spinner | ||
| */ | ||
| size?: 'lg' | 'sm' | ||
| /** | ||
| * Display style of the spinner | ||
| */ | ||
| style?: 'inline' | 'block' | ||
| } | ||
|
|
||
| /** | ||
| * Default prop values for LoadingSpinner component. | ||
| */ | ||
| export const LoadingSpinnerDefaults = { | ||
| size: 'lg', | ||
| style: 'block', | ||
| } as const satisfies Partial<LoadingSpinnerProps> | ||
This file contains hidden or 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,3 @@ | ||
| export { LoadingSpinner } from './LoadingSpinner' | ||
| export type { LoadingSpinnerProps } from './LoadingSpinnerTypes' | ||
| export { LoadingSpinnerDefaults } from './LoadingSpinnerTypes' |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.