1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/components/app/permissions-connect-permission-list/permissions-connect-permission-list.js
David Drazic 8603a4b067
[FLASK] Add permission cell component (#18372)
* Add permission cell component

Add storybook and handling for revoked permission colors

* Fix things after conflict resolve after rebase

* Add code refactoring and minor UI changes

* Add permission cell component to snap-update flow

* Update storybook

* Add unit tests for permission cell

* Update component padding

* Fix spacing between permission cells

* Fix main icon color for approved permissions

* Update width value with constant
2023-04-03 19:33:54 +02:00

32 lines
1000 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { getWeightedPermissions } from '../../../helpers/utils/permission';
import { useI18nContext } from '../../../hooks/useI18nContext';
import PermissionCell from '../permission-cell';
import Box from '../../ui/box';
export default function PermissionsConnectPermissionList({ permissions }) {
const t = useI18nContext();
return (
<Box paddingTop={2} paddingBottom={2}>
{getWeightedPermissions(t, permissions).map((permission, index) => {
return (
<PermissionCell
title={permission.label}
description={permission.description}
weight={permission.weight}
avatarIcon={permission.leftIcon}
dateApproved={permission?.permissionValue?.date}
key={`${permission.permissionName}-${index}`}
/>
);
})}
</Box>
);
}
PermissionsConnectPermissionList.propTypes = {
permissions: PropTypes.object.isRequired,
};