-
Notifications
You must be signed in to change notification settings - Fork 63
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
Skeleton Loader - Chromatic tests #2296
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ad04af8
initial list skeleton
TheSonOfThomp e2bc0f6
Updates list skeleton styles
TheSonOfThomp 1229b13
adds test case
TheSonOfThomp ca6801a
Create swift-garlics-wave.md
TheSonOfThomp e1a5720
update import
TheSonOfThomp f2fb5ce
revert table stories
TheSonOfThomp b6db5ee
Adds `enableAnimations` prop
TheSonOfThomp dc3600b
updates story files
TheSonOfThomp dc42f9b
Update CardSkeleton.tsx
TheSonOfThomp 0f09d0a
Use Size enum. Rm debug values
TheSonOfThomp 6a60391
Merge branch 'main' into adam/skeleton-tests
TheSonOfThomp 96e16c5
Merge branch 'main' into adam/skeleton-tests
TheSonOfThomp 1e88a4e
Create warm-avocados-enjoy.md
TheSonOfThomp 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 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,5 @@ | ||
--- | ||
'@leafygreen-ui/skeleton-loader': minor | ||
--- | ||
|
||
Adds `enableAnimations` prop |
36 changes: 22 additions & 14 deletions
36
packages/skeleton-loader/src/CardSkeleton/CardSkeleton.stories.tsx
This file contains 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 |
---|---|---|
@@ -1,24 +1,32 @@ | ||
import React from 'react'; | ||
import { storybookArgTypes } from '@lg-tools/storybook-utils'; | ||
import { StoryFn } from '@storybook/react'; | ||
import { StoryMetaType, StoryType } from '@lg-tools/storybook-utils'; | ||
|
||
import { CardSkeleton } from '..'; | ||
|
||
export default { | ||
title: 'Components/SkeletonLoader', | ||
component: CardSkeleton, | ||
parameters: { | ||
default: null, | ||
controls: { exclude: ['darkMode', 'ref'] }, | ||
generate: { | ||
storyNames: ['Card'], | ||
combineArgs: { | ||
darkMode: [false, true], | ||
}, | ||
decorator: Instance => ( | ||
<div style={{ width: 500 }}> | ||
<Instance /> | ||
</div> | ||
), | ||
}, | ||
}, | ||
args: { | ||
enableAnimations: false, | ||
}, | ||
argTypes: { | ||
darkMode: storybookArgTypes.darkMode, | ||
enableAnimations: { control: 'boolean' }, | ||
}, | ||
decorators: [ | ||
(Story: StoryFn) => ( | ||
<div style={{ width: 700 }}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
}; | ||
} satisfies StoryMetaType<typeof CardSkeleton>; | ||
|
||
export const Card: StoryFn<typeof CardSkeleton> = props => ( | ||
<CardSkeleton {...props} /> | ||
); | ||
export const Card: StoryType<typeof CardSkeleton> = () => <></>; |
This file contains 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
5 changes: 4 additions & 1 deletion
5
packages/skeleton-loader/src/CardSkeleton/CardSkeleton.types.ts
This file contains 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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { DarkModeProps, HTMLElementProps } from '@leafygreen-ui/lib'; | ||
|
||
import { SharedSkeletonProps } from '../Skeleton/Skeleton.types'; | ||
|
||
export interface CardSkeletonProps | ||
extends HTMLElementProps<'div'>, | ||
extends SharedSkeletonProps, | ||
HTMLElementProps<'div'>, | ||
DarkModeProps {} |
36 changes: 22 additions & 14 deletions
36
packages/skeleton-loader/src/CodeSkeleton/CodeSkeleton.stories.tsx
This file contains 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 |
---|---|---|
@@ -1,24 +1,32 @@ | ||
import React from 'react'; | ||
import { storybookArgTypes } from '@lg-tools/storybook-utils'; | ||
import { StoryFn } from '@storybook/react'; | ||
import { StoryMetaType, StoryType } from '@lg-tools/storybook-utils'; | ||
|
||
import { CodeSkeleton } from '..'; | ||
|
||
export default { | ||
title: 'Components/SkeletonLoader', | ||
component: CodeSkeleton, | ||
parameters: { | ||
default: null, | ||
controls: { exclude: ['darkMode', 'ref'] }, | ||
generate: { | ||
storyNames: ['Code'], | ||
combineArgs: { | ||
darkMode: [false, true], | ||
}, | ||
decorator: Instance => ( | ||
<div style={{ width: 500 }}> | ||
<Instance /> | ||
</div> | ||
), | ||
}, | ||
}, | ||
args: { | ||
enableAnimations: false, | ||
}, | ||
argTypes: { | ||
darkMode: storybookArgTypes.darkMode, | ||
enableAnimations: { control: 'boolean' }, | ||
}, | ||
decorators: [ | ||
(Story: StoryFn) => ( | ||
<div style={{ width: 700 }}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
}; | ||
} satisfies StoryMetaType<typeof CodeSkeleton>; | ||
|
||
export const Code: StoryFn<typeof CodeSkeleton> = props => ( | ||
<CodeSkeleton {...props} /> | ||
); | ||
export const Code: StoryType<typeof CodeSkeleton> = () => <></>; |
This file contains 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
5 changes: 4 additions & 1 deletion
5
packages/skeleton-loader/src/CodeSkeleton/CodeSkeleton.types.ts
This file contains 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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { DarkModeProps, HTMLElementProps } from '@leafygreen-ui/lib'; | ||
|
||
import { SharedSkeletonProps } from '../Skeleton/Skeleton.types'; | ||
|
||
export interface CodeSkeletonProps | ||
extends DarkModeProps, | ||
extends SharedSkeletonProps, | ||
DarkModeProps, | ||
HTMLElementProps<'div'> {} |
36 changes: 22 additions & 14 deletions
36
packages/skeleton-loader/src/FormSkeleton/FormSkeleton.stories.tsx
This file contains 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 |
---|---|---|
@@ -1,24 +1,32 @@ | ||
import React from 'react'; | ||
import { storybookArgTypes } from '@lg-tools/storybook-utils'; | ||
import { StoryFn } from '@storybook/react'; | ||
import { StoryMetaType, StoryType } from '@lg-tools/storybook-utils'; | ||
|
||
import { FormSkeleton } from '.'; | ||
|
||
export default { | ||
title: 'Components/SkeletonLoader', | ||
component: FormSkeleton, | ||
parameters: { | ||
controls: { exclude: ['darkMode', 'ref'] }, | ||
default: null, | ||
generate: { | ||
storyNames: ['Form'], | ||
combineArgs: { | ||
darkMode: [false, true], | ||
}, | ||
decorator: Instance => ( | ||
<div style={{ width: 500 }}> | ||
<Instance /> | ||
</div> | ||
), | ||
}, | ||
}, | ||
args: { | ||
enableAnimations: false, | ||
}, | ||
argTypes: { | ||
darkMode: storybookArgTypes.darkMode, | ||
enableAnimations: { control: 'boolean' }, | ||
}, | ||
decorators: [ | ||
(Story: StoryFn) => ( | ||
<div style={{ width: 700 }}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
}; | ||
} satisfies StoryMetaType<typeof FormSkeleton>; | ||
|
||
export const Form: StoryFn<typeof FormSkeleton> = props => ( | ||
<FormSkeleton {...props} /> | ||
); | ||
export const Form: StoryType<typeof FormSkeleton> = () => <></>; |
This file contains 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
5 changes: 4 additions & 1 deletion
5
packages/skeleton-loader/src/FormSkeleton/FormSkeleton.types.ts
This file contains 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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { DarkModeProps, HTMLElementProps } from '@leafygreen-ui/lib'; | ||
|
||
import { SharedSkeletonProps } from '../Skeleton/Skeleton.types'; | ||
|
||
export interface FormSkeletonProps | ||
extends DarkModeProps, | ||
extends SharedSkeletonProps, | ||
DarkModeProps, | ||
HTMLElementProps<'div'> {} |
47 changes: 23 additions & 24 deletions
47
packages/skeleton-loader/src/ListSkeleton/ListSkeleton.stories.tsx
This file contains 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 |
---|---|---|
@@ -1,36 +1,35 @@ | ||
import React from 'react'; | ||
import { StoryMetaType, StoryType } from '@lg-tools/storybook-utils'; | ||
|
||
import { ListSkeleton, type ListSkeletonProps } from '.'; | ||
import { ListSkeleton } from '.'; | ||
|
||
const meta: StoryMetaType<typeof ListSkeleton> = { | ||
title: 'Components/SkeletonLoader/List', | ||
export default { | ||
title: 'Components/SkeletonLoader', | ||
component: ListSkeleton, | ||
parameters: { | ||
default: null, | ||
controls: { exclude: ['darkMode', 'ref', 'size'] }, | ||
generate: { | ||
storyNames: ['List'], | ||
combineArgs: { | ||
darkMode: [false, true], | ||
bulletsOnly: [false, true], | ||
}, | ||
decorator: Instance => ( | ||
<div style={{ width: 256 }}> | ||
<Instance /> | ||
</div> | ||
), | ||
}, | ||
}, | ||
args: { | ||
enableAnimations: false, | ||
count: 5, | ||
bulletsOnly: false, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Basic: StoryType<typeof ListSkeleton> = ( | ||
args: ListSkeletonProps, | ||
) => { | ||
return ( | ||
<div style={{ width: 256 }}> | ||
<ListSkeleton {...args} /> | ||
</div> | ||
); | ||
}; | ||
argTypes: { | ||
enableAnimations: { control: 'boolean' }, | ||
count: { control: 'number' }, | ||
}, | ||
} satisfies StoryMetaType<typeof ListSkeleton>; | ||
|
||
export const BulletsOnly: StoryType<typeof ListSkeleton> = () => { | ||
return ( | ||
<div style={{ width: 256 }}> | ||
<ListSkeleton bulletsOnly /> | ||
</div> | ||
); | ||
}; | ||
export const List: StoryType<typeof ListSkeleton> = () => <></>; |
This file contains 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
5 changes: 4 additions & 1 deletion
5
packages/skeleton-loader/src/ListSkeleton/ListSkeleton.types.ts
This file contains 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.
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.
Should this be true by default?
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.
Not for the snapshot stories. We want to disable animations here so the "shimmer" effect stops, which ensures consistent UI snapshots