mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-04 23:14:56 +01:00
69c2cd3a94
* 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
32 lines
894 B
JavaScript
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,
|
|
};
|