Fix Category missing key + Fix button cannot be inside button

This commit is contained in:
Eric NGUYEN 2022-09-16 14:53:13 +02:00
parent e94671d1d8
commit ce65d448c9
3 changed files with 14 additions and 10 deletions

View file

@ -1,4 +1,3 @@
import { ChevronRightIcon } from '@heroicons/react/outline';
import * as React from 'react';
import { IAvailableContainer } from '../../Interfaces/IAvailableContainer';
import { TruncateString } from '../../utils/stringtools';
@ -23,9 +22,10 @@ export function Sidebar(props: ISidebarProps): JSX.Element {
return;
}
const componentButton = (<button type="button"
className='w-full justify-center h-16 transition-all sidebar-component'
const componentButton = (<button
key={componentOption.Type}
type="button"
className='w-full justify-center h-16 transition-all sidebar-component'
id={componentOption.Type}
title={componentOption.Type}
onClick={() => props.buttonOnClick(componentOption.Type)}
@ -56,7 +56,10 @@ export function Sidebar(props: ISidebarProps): JSX.Element {
// build the categories
categories.forEach((options, category) => {
rootElements.unshift(
<Category category={category}>
<Category
key={category}
category={category}
>
{ options }
</Category>);
});