Add todo item click handler

This commit is contained in:
Emili Castells Guasch 2025-01-03 12:11:31 +01:00
parent 3ec41d47ae
commit bdb72d7ad0
2 changed files with 11 additions and 2 deletions

View file

@ -8,7 +8,11 @@ const TodoSettingsBlock = ( { todosData, className = '' } ) => {
className={ `ppcp-r-settings-block__todo ppcp-r-todo-items ${ className }` }
>
{ todosData.map( ( todo ) => (
<TodoItem key={ todo.id } title={ todo.title } />
<TodoItem
key={ todo.id }
title={ todo.title }
onClick={ todo.onClick }
/>
) ) }
</div>
);
@ -16,7 +20,7 @@ const TodoSettingsBlock = ( { todosData, className = '' } ) => {
const TodoItem = ( props ) => {
return (
<div className="ppcp-r-todo-item">
<div className="ppcp-r-todo-item" onClick={ props.onClick }>
<div className="ppcp-r-todo-item__inner">
<div className="ppcp-r-todo-item__icon"></div>
<div className="ppcp-r-todo-item__description">

View file

@ -10,6 +10,7 @@ import FeatureSettingsBlock from '../../ReusableComponents/SettingsBlocks/Featur
import { TITLE_BADGE_POSITIVE } from '../../ReusableComponents/TitleBadge';
import { useMerchantInfo } from '../../../data/common/hooks';
import { STORE_NAME } from '../../../data/common';
import { updateQueryString } from '../../../utils/navigation';
const TabOverview = () => {
const [ todosData ] = useState( todosDataDefault );
@ -188,6 +189,10 @@ const todosDataDefault = [
isCompleted: () => {
return false;
},
onClick: ( event ) => {
event.preventDefault();
updateQueryString( { panel: 'payment-methods' } );
},
},
{
id: 'enable_credit_debit_cards',