1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 23:58:06 +01:00
metamask-extension/ui/components/app/permissions-connect-permission-list/permissions-connect-permission-list.js
Ariella Vu 69c2cd3a94
Permissions: convert hook to util (#13906)
* Permissions: convert hook into helper util
- instantiate once
- freeze
- alphabetize
- add additional comments to @param
https://github.com/MetaMask/metamask-extension/pull/13906#pullrequestreview-906554847
2022-03-14 15:26:02 -03:00

32 lines
894 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { getPermissionDescription } from '../../../helpers/utils/permission';
import { useI18nContext } from '../../../hooks/useI18nContext';
export default function PermissionsConnectPermissionList({ permissions }) {
const t = useI18nContext();
return (
<div className="permissions-connect-permission-list">
{Object.keys(permissions).map((permission) => {
const { label, leftIcon, rightIcon } = getPermissionDescription(
t,
permission,
);
return (
<div className="permission" key={permission}>
<i className={leftIcon} />
{label}
{rightIcon && <i className={rightIcon} />}
</div>
);
})}
</div>
);
}
PermissionsConnectPermissionList.propTypes = {
permissions: PropTypes.object.isRequired,
};