-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: APP-2943 - Implement MemberDataListItem.Skeleton module compone…
…nt (#178)
- Loading branch information
1 parent
6b2eed4
commit 54442e4
Showing
9 changed files
with
92 additions
and
10 deletions.
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
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
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
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,7 +1,10 @@ | ||
import { MemberDataListItemSkeleton } from './memberDataListItemSkeleton'; | ||
import { MemberDataListItemStructure } from './memberDataListItemStructure'; | ||
|
||
export const MemberDataListItem = { | ||
Structure: MemberDataListItemStructure, | ||
Skeleton: MemberDataListItemSkeleton, | ||
}; | ||
|
||
export * from './memberDataListItemSkeleton'; | ||
export * from './memberDataListItemStructure'; |
1 change: 1 addition & 0 deletions
1
src/modules/components/member/memberDataListItem/memberDataListItemSkeleton/index.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { MemberDataListItemSkeleton, type IMemberDataListItemSkeletonProps } from './memberDataListItemSkeleton'; |
30 changes: 30 additions & 0 deletions
30
...mber/memberDataListItem/memberDataListItemSkeleton/memberDataListItemSkeleton.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { MemberDataListItem } from '../../../..'; | ||
import { DataList } from '../../../../../core'; | ||
|
||
const meta: Meta<typeof MemberDataListItem.Skeleton> = { | ||
title: 'Modules/Components/Member/MemberDataListItem.Skeleton', | ||
component: MemberDataListItem.Skeleton, | ||
tags: ['autodocs'], | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/design/ISSDryshtEpB7SUSdNqAcw/branch/P0GeJKqILL7UXvaqu5Jj7V/Aragon-ODS?m=auto&node-id=14385%3A25034&t=E0kPRQYhJqWbVmAh-1', | ||
}, | ||
}, | ||
}; | ||
|
||
type Story = StoryObj<typeof MemberDataListItem.Skeleton>; | ||
|
||
/** | ||
* Default usage example of the MemberDataListItemSkeleton component. | ||
*/ | ||
export const Default: Story = { | ||
render: () => ( | ||
<DataList.Root entityLabel="Proposal" state="initialLoading" pageSize={1}> | ||
<DataList.Container SkeletonElement={MemberDataListItem.Skeleton} /> | ||
</DataList.Root> | ||
), | ||
}; | ||
|
||
export default meta; |
29 changes: 29 additions & 0 deletions
29
...nents/member/memberDataListItem/memberDataListItemSkeleton/memberDataListItemSkeleton.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import classNames from 'classnames'; | ||
import { DataList, StateSkeletonBar, StateSkeletonCircular, type IDataListItemProps } from '../../../../../core'; | ||
|
||
export interface IMemberDataListItemSkeletonProps extends IDataListItemProps {} | ||
|
||
export const MemberDataListItemSkeleton: React.FC<IMemberDataListItemSkeletonProps> = (props) => { | ||
const { className, ...otherProps } = props; | ||
|
||
return ( | ||
<DataList.Item | ||
tabIndex={0} | ||
aria-busy="true" | ||
aria-label="loading" | ||
className={classNames('bg-neutral-0 py-3 md:py-3.5', className)} | ||
{...otherProps} | ||
> | ||
<div className="flex flex-col items-start justify-center gap-y-3 py-2 md:min-w-44 md:gap-y-4 md:py-3 "> | ||
<StateSkeletonCircular size="sm" responsiveSize={{ md: 'lg' }} /> | ||
|
||
<StateSkeletonBar size="lg" responsiveSize={{ md: 'xl' }} width="100%" /> | ||
|
||
<div className="flex w-full flex-col gap-y-2 md:w-5/6 md:gap-y-2.5"> | ||
<StateSkeletonBar width="50%" /> | ||
<StateSkeletonBar width="65%" /> | ||
</div> | ||
</div> | ||
</DataList.Item> | ||
); | ||
}; |
22 changes: 22 additions & 0 deletions
22
...member/memberDataListItem/memberDataListItemSkeleton/memberDataListItemStructure.test.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { DataList } from '../../../../../core'; | ||
import { MemberDataListItemSkeleton, type IMemberDataListItemSkeletonProps } from './memberDataListItemSkeleton'; | ||
|
||
describe('<MemberDataListItem.Skeleton /> component', () => { | ||
const createTestComponent = (props?: Partial<IMemberDataListItemSkeletonProps>) => { | ||
const completeProps: IMemberDataListItemSkeletonProps = { ...props }; | ||
|
||
return ( | ||
<DataList.Root entityLabel="Member"> | ||
<MemberDataListItemSkeleton {...completeProps} /> | ||
</DataList.Root> | ||
); | ||
}; | ||
|
||
it('has correct accessibility attributes', () => { | ||
render(createTestComponent()); | ||
const listItem = screen.getByLabelText('loading'); | ||
expect(listItem).toHaveAttribute('aria-busy', 'true'); | ||
expect(listItem).toHaveAttribute('tabIndex', '0'); | ||
}); | ||
}); |
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