SettingsPage: Fix prop-types

This commit is contained in:
Gustav Hansen 2022-10-21 14:46:30 +02:00
parent 1ffabc219a
commit 756c4bcc04
3 changed files with 8 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import { IconButton } from '@strapi/design-system/IconButton';
import { stopPropagation, onRowClick, pxToRem } from '@strapi/helper-plugin';
import { useIntl } from 'react-intl';
const RoleRow = ({ id, name, description, usersCount, icons }) => {
const RoleRow = ({ id, name, description, usersCount, icons, rowIndex }) => {
const { formatMessage } = useIntl();
const usersCountText = formatMessage(
@ -21,6 +21,7 @@ const RoleRow = ({ id, name, description, usersCount, icons }) => {
return (
<Tr
aria-rowindex={rowIndex}
key={id}
{...onRowClick({
fn: icons[1].onClick,
@ -60,6 +61,7 @@ RoleRow.propTypes = {
description: PropTypes.string.isRequired,
usersCount: PropTypes.number.isRequired,
icons: PropTypes.array.isRequired,
rowIndex: PropTypes.number.isRequired,
};
export default RoleRow;

View File

@ -168,7 +168,7 @@ const RoleListPage = () => {
</Tr>
</Thead>
<Tbody>
{sortedRoles?.map((role) => (
{sortedRoles?.map((role, rowIndex) => (
<RoleRow
key={role.id}
id={role.id}
@ -176,6 +176,7 @@ const RoleListPage = () => {
description={role.description}
usersCount={role.usersCount}
icons={getIcons(role)}
rowIndex={rowIndex + 2}
/>
))}
</Tbody>

View File

@ -303,7 +303,7 @@ const RoleListPage = () => {
}
>
<Thead>
<Tr>
<Tr aria-rowindex={1}>
<Th>
<Typography variant="sigma" textColor="neutral600">
{formatMessage({
@ -339,7 +339,7 @@ const RoleListPage = () => {
</Tr>
</Thead>
<Tbody>
{sortedRoles?.map((role) => (
{sortedRoles?.map((role, index) => (
<BaseRoleRow
key={role.id}
id={role.id}
@ -347,6 +347,7 @@ const RoleListPage = () => {
description={role.description}
usersCount={role.usersCount}
icons={getIcons(role)}
rowIndex={index + 2}
/>
))}
</Tbody>