Skip to content

Commit

Permalink
UX: Multichain: Ensure all components have proptype docs
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing committed Sep 23, 2023
1 parent 315c043 commit d34b7cb
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,20 @@ export const AccountDetailsAuthenticate = ({
};

AccountDetailsAuthenticate.propTypes = {
/**
* The account address
*/
address: PropTypes.string.isRequired,
/**
* Executes upon Cancel button click
*/
onCancel: PropTypes.func.isRequired,
/**
* Private key setter
*/
setPrivateKey: PropTypes.func.isRequired,
/**
* showHoldToReveal setter
*/
setShowHoldToReveal: PropTypes.func.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,20 @@ export const AccountDetailsDisplay = ({
};

AccountDetailsDisplay.propTypes = {
/**
* Array of user accounts
*/
accounts: PropTypes.array.isRequired,
/**
* Name of the current account
*/
accountName: PropTypes.string.isRequired,
/**
* Current address
*/
address: PropTypes.string.isRequired,
/**
* Executes upon Export button click
*/
onExportClick: PropTypes.func.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,16 @@ export const AccountDetailsKey = ({ accountName, onClose, privateKey }) => {
};

AccountDetailsKey.propTypes = {
/**
* Name of the account
*/
accountName: PropTypes.string.isRequired,
/**
* Executes upon Close button click
*/
onClose: PropTypes.func.isRequired,
/**
* The private key
*/
privateKey: PropTypes.string.isRequired,
};
3 changes: 3 additions & 0 deletions ui/components/multichain/account-details/account-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,8 @@ export const AccountDetails = ({ address }) => {
};

AccountDetails.propTypes = {
/**
* The address to show account details for
*/
address: PropTypes.string,
};
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@ AccountListItemMenu.propTypes = {
* Represents if the account should be removable
*/
isRemovable: PropTypes.bool.isRequired,
/**
* Identity of the account
*/
/**
* Identity of the account
*/
Expand Down
30 changes: 30 additions & 0 deletions ui/components/multichain/activity-list-item/activity-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,44 @@ export const ActivityListItem = ({
};

ActivityListItem.propTypes = {
/**
* Top content for the activity
*/
topContent: PropTypes.node,
/**
* Icon which represents the activity
*/
icon: PropTypes.node,
/**
* Title text
*/
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
/**
* Additional text detail
*/
subtitle: PropTypes.node,
/**
* Middle content
*/
midContent: PropTypes.node,
/**
* Additional variable contents
*/
children: PropTypes.node,
/**
* Right-most content
*/
rightContent: PropTypes.node,
/**
* Executes upon click of the activity
*/
onClick: PropTypes.func,
/**
* Additional classname for this component
*/
className: PropTypes.string,
/**
* Test ID for this component
*/
'data-testid': PropTypes.string,
};
3 changes: 3 additions & 0 deletions ui/components/multichain/create-account/create-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,8 @@ export const CreateAccount = ({ onActionComplete }) => {
};

CreateAccount.propTypes = {
/**
* Executes when the Create button is clicked
*/
onActionComplete: PropTypes.func.isRequired,
};
21 changes: 15 additions & 6 deletions ui/components/multichain/import-account/bottom-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import { Display } from '../../../helpers/constants/design-system';
import { useI18nContext } from '../../../hooks/useI18nContext';
import * as actions from '../../../store/actions';

BottomButtons.propTypes = {
importAccountFunc: PropTypes.func.isRequired,
isPrimaryDisabled: PropTypes.bool.isRequired,
onActionComplete: PropTypes.func.isRequired,
};

export default function BottomButtons({
importAccountFunc,
isPrimaryDisabled,
Expand Down Expand Up @@ -58,3 +52,18 @@ export default function BottomButtons({
</Box>
);
}

BottomButtons.propTypes = {
/**
* Function to import the account
*/
importAccountFunc: PropTypes.func.isRequired,
/**
* Represents if the action button is disabled
*/
isPrimaryDisabled: PropTypes.bool.isRequired,
/**
* Executes when the primary action is complete
*/
onActionComplete: PropTypes.func.isRequired,
};
3 changes: 3 additions & 0 deletions ui/components/multichain/import-account/import-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,8 @@ export const ImportAccount = ({ onActionComplete }) => {
};

ImportAccount.propTypes = {
/**
* Executes when the key is imported
*/
onActionComplete: PropTypes.func.isRequired,
};
16 changes: 11 additions & 5 deletions ui/components/multichain/import-account/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ import { useI18nContext } from '../../../hooks/useI18nContext';
import { displayWarning } from '../../../store/actions';
import BottomButtons from './bottom-buttons';

JsonImportSubview.propTypes = {
importAccountFunc: PropTypes.func.isRequired,
onActionComplete: PropTypes.func.isRequired,
};

export default function JsonImportSubview({
importAccountFunc,
onActionComplete,
Expand Down Expand Up @@ -104,3 +99,14 @@ export default function JsonImportSubview({
</>
);
}

JsonImportSubview.propTypes = {
/**
* Function to import the account
*/
importAccountFunc: PropTypes.func.isRequired,
/**
* Executes when the key is imported
*/
onActionComplete: PropTypes.func.isRequired,
};
16 changes: 11 additions & 5 deletions ui/components/multichain/import-account/private-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import {
import { useI18nContext } from '../../../hooks/useI18nContext';
import BottomButtons from './bottom-buttons';

PrivateKeyImportView.propTypes = {
importAccountFunc: PropTypes.func.isRequired,
onActionComplete: PropTypes.func.isRequired,
};

export default function PrivateKeyImportView({
importAccountFunc,
onActionComplete,
Expand Down Expand Up @@ -60,3 +55,14 @@ export default function PrivateKeyImportView({
</>
);
}

PrivateKeyImportView.propTypes = {
/**
* Function to import the account
*/
importAccountFunc: PropTypes.func.isRequired,
/**
* Executes when the key is imported
*/
onActionComplete: PropTypes.func.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,8 @@ export const ImportNftsModal = ({ onClose }) => {
};

ImportNftsModal.propTypes = {
/**
* Executes when the modal closes
*/
onClose: PropTypes.func.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export const ImportTokensModalConfirm = ({ onBackClick, onImportClick }) => {
};

ImportTokensModalConfirm.propTypes = {
/**
* Executes when the Back button is clicked
*/
onBackClick: PropTypes.func.isRequired,
/**
* Executes when the Import button is clicked
*/
onImportClick: PropTypes.func.isRequired,
};
12 changes: 12 additions & 0 deletions ui/components/multichain/menu-items/account-details-menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,20 @@ export const AccountDetailsMenuItem = ({
};

AccountDetailsMenuItem.propTypes = {
/**
* Represents the "location" property of the metrics event
*/
metricsLocation: PropTypes.string.isRequired,
/**
* Closes the menu
*/
closeMenu: PropTypes.func,
/**
* Address to show account details for
*/
address: PropTypes.string.isRequired,
/**
* Custom properties for the menu item text
*/
textProps: PropTypes.object,
};
14 changes: 13 additions & 1 deletion ui/components/multichain/menu-items/view-explorer-menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,20 @@ export const ViewExplorerMenuItem = ({
};

ViewExplorerMenuItem.propTypes = {
/**
* Represents the "location" property of the metrics event
*/
metricsLocation: PropTypes.string.isRequired,
/**
* Closes the menu
*/
closeMenu: PropTypes.func,
textProps: PropTypes.object,
/**
* Address to show account details for
*/
address: PropTypes.string.isRequired,
/**
* Custom properties for the menu item text
*/
textProps: PropTypes.object,
};
27 changes: 27 additions & 0 deletions ui/components/multichain/nft-item/nft-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,40 @@ export const NftItem = ({
};

NftItem.propTypes = {
/**
* NFT media source
*/
src: PropTypes.string,
/**
* Alt text for the NFT
*/
alt: PropTypes.string.isRequired,
/**
* The NFT's name
*/
name: PropTypes.string.isRequired,
/**
* Name of the network the NFT lives on
*/
networkName: PropTypes.string.isRequired,
/**
* Image that represents the network
*/
networkSrc: PropTypes.string.isRequired,
/**
* Token ID of the NFT
*/
tokenId: PropTypes.string.isRequired,
/**
* Executes when the NFT is clicked
*/
onClick: PropTypes.func,
/**
* Represents if the NFT is clickable for larger image
*/
clickable: PropTypes.bool,
/**
* The NFT image URL
*/
nftImageURL: PropTypes.string,
};

0 comments on commit d34b7cb

Please sign in to comment.