-
Notifications
You must be signed in to change notification settings - Fork 11
feat(APP-4405): Implement SmartContractFunctionDataListItem module component #530
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
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2c8ff9b
feat: implement smartcontractfunctiondatalistitem component
shan8851 1778ef4
chore: cleanup
shan8851 5524fc0
chore: prettify
shan8851 a83af23
chore: changeset
shan8851 e90c393
chore: fix asChild styling
shan8851 c0db9b7
chore: remove redundant modules copy and tests from actionsitem
shan8851 9b4f4ab
chore: prettify
shan8851 3acca60
chore: update function selector mapping
shan8851 974f024
chore: fix types
shan8851 3d26f19
Merge branch 'main' into feat/APP-4405
cgero-eth 67d0366
chore: clean up and resolve PR convos
shan8851 50cb860
Merge branch 'main' into feat/APP-4405
shan8851 a089039
chore: prettify
shan8851 098517e
chore: update skeleton
shan8851 417ad8d
chore: prettify and extract content
shan8851 1d94c99
chore: remove content component, add as child prop to correctly style…
shan8851 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@aragon/gov-ui-kit': patch | ||
| --- | ||
|
|
||
| Implement SmartContractFunctionDataListItem module component |
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
11 changes: 3 additions & 8 deletions
11
...ents/proposal/proposalActions/proposalActionsItemSkeleton/proposalActionsItemSkeleton.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
10 changes: 10 additions & 0 deletions
10
src/modules/components/smartContract/smartContractFunctionDataListItem/index.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,10 @@ | ||
| import { SmartContractFunctionDataListItemSkeleton } from './smartContractFunctionDataListItemSkeleton'; | ||
| import { SmartContractFunctionDataListItemStructure } from './smartContractFunctionDataListItemStructure'; | ||
|
|
||
| export const SmartContractFunctionDataListItem = { | ||
| Skeleton: SmartContractFunctionDataListItemSkeleton, | ||
| Structure: SmartContractFunctionDataListItemStructure, | ||
| }; | ||
|
|
||
| export * from './smartContractFunctionDataListItemSkeleton'; | ||
| export * from './smartContractFunctionDataListItemStructure'; |
6 changes: 6 additions & 0 deletions
6
...ract/smartContractFunctionDataListItem/smartContractFunctionDataListItemSkeleton/index.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,6 @@ | ||
| export { | ||
| SmartContractFunctionDataListItemSkeleton, | ||
| type ISmartContractFunctionDataListItemSkeletonProps, | ||
| } from './smartContractFunctionDataListItemSkeleton'; | ||
|
|
||
| export { SmartContractFunctionDataListItemSkeletonContent } from './smartContractFunctionDataListItemSkeletonContent'; | ||
|
shan8851 marked this conversation as resolved.
Outdated
|
||
22 changes: 22 additions & 0 deletions
22
...ontractFunctionDataListItemSkeleton/smartContractFunctionDataListItemSkeleton.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,22 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react-vite'; | ||
| import { SmartContractFunctionDataListItem } from '../../smartContractFunctionDataListItem'; | ||
|
|
||
| const meta: Meta<typeof SmartContractFunctionDataListItem.Skeleton> = { | ||
| title: 'Modules/Components/SmartContract/SmartContractFunctionDataListItem/SmartContractFunctionDataListItem.Skeleton', | ||
| component: SmartContractFunctionDataListItem.Skeleton, | ||
| parameters: { | ||
| design: { | ||
| type: 'figma', | ||
| url: 'https://www.figma.com/design/mnH992k1U8hHBzTHFC2W3U/Aragon-App?node-id=13248-149568', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| type Story = StoryObj<typeof SmartContractFunctionDataListItem.Skeleton>; | ||
|
|
||
| /** | ||
| * Default usage example of the SmartContractFunctionDataListItem.Skeleton component. | ||
| */ | ||
| export const Default: Story = {}; | ||
|
|
||
| export default meta; |
20 changes: 20 additions & 0 deletions
20
...rtContractFunctionDataListItemSkeleton/smartContractFunctionDataListItemSkeleton.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,20 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
| import { | ||
| SmartContractFunctionDataListItem, | ||
| type ISmartContractFunctionDataListItemSkeletonProps, | ||
| } from '../../smartContractFunctionDataListItem'; | ||
|
|
||
| describe('<SmartContractFunctionDataListItem.Skeleton /> component', () => { | ||
| const createTestComponent = (props?: Partial<ISmartContractFunctionDataListItemSkeletonProps>) => { | ||
| const completeProps: ISmartContractFunctionDataListItemSkeletonProps = { ...props }; | ||
|
|
||
| return <SmartContractFunctionDataListItem.Skeleton {...completeProps} />; | ||
| }; | ||
|
|
||
| it('has correct accessibility attributes', () => { | ||
| render(createTestComponent()); | ||
| const listItem = screen.getByLabelText('loading'); | ||
| expect(listItem).toHaveAttribute('aria-busy', 'true'); | ||
| expect(listItem).toHaveAttribute('tabIndex', '0'); | ||
| }); | ||
| }); |
26 changes: 26 additions & 0 deletions
26
...m/smartContractFunctionDataListItemSkeleton/smartContractFunctionDataListItemSkeleton.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,26 @@ | ||
| import classNames from 'classnames'; | ||
| import { DataList, type IDataListItemProps } from '../../../../../core'; | ||
| import { SmartContractFunctionDataListItemSkeletonContent } from './smartContractFunctionDataListItemSkeletonContent'; | ||
|
|
||
| export type ISmartContractFunctionDataListItemSkeletonProps = IDataListItemProps; | ||
|
|
||
| export const SmartContractFunctionDataListItemSkeleton: React.FC<ISmartContractFunctionDataListItemSkeletonProps> = ( | ||
| props, | ||
| ) => { | ||
| const { className, ...otherProps } = props; | ||
|
|
||
| return ( | ||
| <DataList.Item | ||
|
shan8851 marked this conversation as resolved.
|
||
| tabIndex={0} | ||
| aria-busy="true" | ||
| aria-label="loading" | ||
| className={classNames( | ||
| 'border-neutral-0 flex min-h-[67.5px] w-full flex-col gap-3 py-4 md:min-h-[88.5px]', | ||
| className, | ||
| )} | ||
| {...otherProps} | ||
| > | ||
| <SmartContractFunctionDataListItemSkeletonContent /> | ||
| </DataList.Item> | ||
| ); | ||
| }; | ||
19 changes: 19 additions & 0 deletions
19
...ContractFunctionDataListItemSkeleton/smartContractFunctionDataListItemSkeletonContent.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,19 @@ | ||
| import { StateSkeletonBar } from '../../../../../core'; | ||
|
|
||
| export interface ISmartContractFunctionDataListItemSkeletonContentProps {} | ||
|
|
||
| export const SmartContractFunctionDataListItemSkeletonContent: React.FC< | ||
| ISmartContractFunctionDataListItemSkeletonContentProps | ||
| > = () => { | ||
| return ( | ||
| <> | ||
| <div className="flex w-1/2 md:w-1/3"> | ||
| <StateSkeletonBar responsiveSize={{ md: 'lg' }} width="100%" /> | ||
| </div> | ||
| <div className="flex w-3/4 gap-x-2 md:w-1/2"> | ||
| <StateSkeletonBar responsiveSize={{ md: 'lg' }} width="50%" /> | ||
| <StateSkeletonBar responsiveSize={{ md: 'lg' }} width="50%" /> | ||
| </div> | ||
| </> | ||
| ); | ||
| }; |
4 changes: 4 additions & 0 deletions
4
...act/smartContractFunctionDataListItem/smartContractFunctionDataListItemStructure/index.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,4 @@ | ||
| export { | ||
| SmartContractFunctionDataListItemStructure, | ||
| type ISmartContractFunctionDataListItemProps, | ||
| } from './smartContractFunctionDataListItemStructure'; |
65 changes: 65 additions & 0 deletions
65
...tractFunctionDataListItemStructure/smartContractFunctionDataListItemStructure.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,65 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react-vite'; | ||
| import { SmartContractFunctionDataListItem } from '../../smartContractFunctionDataListItem'; | ||
| import { type SmartContractFunctionDataListItemStructure } from './smartContractFunctionDataListItemStructure'; | ||
|
|
||
| const meta: Meta<typeof SmartContractFunctionDataListItem.Structure> = { | ||
| title: 'Modules/Components/SmartContract/SmartContractFunctionDataListItem/SmartContractFunctionDataListItem.Structure', | ||
| component: SmartContractFunctionDataListItem.Structure, | ||
| parameters: { | ||
| design: { | ||
| type: 'figma', | ||
| url: 'https://www.figma.com/design/mnH992k1U8hHBzTHFC2W3U/Aragon-App?node-id=13248-149568', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| type Story = StoryObj<typeof SmartContractFunctionDataListItemStructure>; | ||
|
|
||
| /** | ||
| * Usage example of the SmartContractFunctionDataListItem.Structure component with verified function and contract names. | ||
| */ | ||
| export const Verified: Story = { | ||
| args: { | ||
| contractAddress: '0x1234567890abcdef1234567890abcdef12345678', | ||
| contractName: 'Uniswap V2 Router', | ||
| functionName: 'addLiquidity', | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * Usage example of the SmartContractFunctionDataListItem.Structure component with unverified function and contract names. | ||
| */ | ||
| export const Unverified: Story = { | ||
| args: { | ||
| contractAddress: '0x1234567890abcdef1234567890abcdef12345678', | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * Usage example of the SmartContractFunctionDataListItem.Structure component with a function signature. | ||
| */ | ||
| export const WithFunctionSignature: Story = { | ||
| args: { | ||
| contractAddress: '0x1234567890abcdef1234567890abcdef12345678', | ||
| contractName: 'Uniswap V2 Router', | ||
| functionName: 'addLiquidity', | ||
| functionParameters: [ | ||
| { name: 'tokenA', type: 'address', value: 0 }, | ||
| { name: 'tokenB', type: 'address', value: 0 }, | ||
| ], | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * Usage example of the SmartContractFunctionDataListItem.Structure component with a remove button. | ||
| */ | ||
| export const WithRemoveButton: Story = { | ||
| args: { | ||
| contractAddress: '0x1234567890abcdef1234567890abcdef12345678', | ||
| contractName: 'Uniswap V2 Router', | ||
| functionName: 'addLiquidity', | ||
| onRemove: () => alert('Function removed'), | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; |
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.