Update IconButtonWithMenu to use shorter prop name to not conflict with the react key
This commit is contained in:
parent
da85caf684
commit
9de1c79da6
2 changed files with 7 additions and 10 deletions
|
@ -5,7 +5,7 @@ import { getTextColorFromBackgroundColor } from '../../utils/Colors.jsx'
|
||||||
|
|
||||||
const IconButtonWithMenu = ({
|
const IconButtonWithMenu = ({
|
||||||
label,
|
label,
|
||||||
key,
|
k,
|
||||||
icon,
|
icon,
|
||||||
options,
|
options,
|
||||||
onItemSelect,
|
onItemSelect,
|
||||||
|
@ -72,14 +72,14 @@ const IconButtonWithMenu = ({
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Menu
|
<Menu
|
||||||
key={key}
|
key={k}
|
||||||
ref={menuRef}
|
ref={menuRef}
|
||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
open={Boolean(anchorEl)}
|
open={Boolean(anchorEl)}
|
||||||
onClose={handleMenuClose}
|
onClose={handleMenuClose}
|
||||||
>
|
>
|
||||||
{title && (
|
{title && (
|
||||||
<MenuItem key={`${key}-title`} disabled>
|
<MenuItem key={`${k}-title`} disabled>
|
||||||
<Typography level='body-sm' sx={{ fontWeight: 'bold' }}>
|
<Typography level='body-sm' sx={{ fontWeight: 'bold' }}>
|
||||||
{title}
|
{title}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
@ -87,7 +87,7 @@ const IconButtonWithMenu = ({
|
||||||
)}
|
)}
|
||||||
{options?.map(item => (
|
{options?.map(item => (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={`${key}-${item?.id}`}
|
key={`${k}-${item?.id}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onItemSelect(item)
|
onItemSelect(item)
|
||||||
setSelectedItem?.selectedItem(item.name)
|
setSelectedItem?.selectedItem(item.name)
|
||||||
|
|
|
@ -420,11 +420,7 @@ const MyChores = () => {
|
||||||
setActiveTextField('search')
|
setActiveTextField('search')
|
||||||
setSearchInputFocus(searchInputFocus + 1)
|
setSearchInputFocus(searchInputFocus + 1)
|
||||||
|
|
||||||
searchInputRef.current.focus()
|
searchInputRef?.current?.focus()
|
||||||
searchInputRef.current.selectionStart =
|
|
||||||
searchInputRef.current.value?.length
|
|
||||||
searchInputRef.current.selectionEnd =
|
|
||||||
searchInputRef.current.value?.length
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Search />
|
<Search />
|
||||||
|
@ -434,6 +430,7 @@ const MyChores = () => {
|
||||||
|
|
||||||
<IconButtonWithMenu
|
<IconButtonWithMenu
|
||||||
title='Group by'
|
title='Group by'
|
||||||
|
key={'icon-menu-group-by'}
|
||||||
icon={<Sort />}
|
icon={<Sort />}
|
||||||
options={[
|
options={[
|
||||||
{ name: 'Due Date', value: 'due_date' },
|
{ name: 'Due Date', value: 'due_date' },
|
||||||
|
@ -456,7 +453,7 @@ const MyChores = () => {
|
||||||
<div className='grid flex-1 grid-cols-3 gap-4'>
|
<div className='grid flex-1 grid-cols-3 gap-4'>
|
||||||
<IconButtonWithMenu
|
<IconButtonWithMenu
|
||||||
label={' Priority'}
|
label={' Priority'}
|
||||||
key={'icon-menu-labels-filter'}
|
key={'icon-menu-priority-filter'}
|
||||||
icon={<PriorityHigh />}
|
icon={<PriorityHigh />}
|
||||||
options={Priorities}
|
options={Priorities}
|
||||||
selectedItem={selectedFilter}
|
selectedItem={selectedFilter}
|
||||||
|
|
Loading…
Add table
Reference in a new issue