Merge pull request #14710 from strapi/chore/fix-prop-types

Chore: Fix prop-type errors in setting list views
This commit is contained in:
Gustav Hansen 2022-10-24 11:50:58 +02:00 committed by GitHub
commit f033c8fe06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>