woocommerce-paypal-payments/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/TodoSettingsBlock.js

40 lines
821 B
JavaScript
Raw Normal View History

2025-01-03 11:21:26 +01:00
const TodoSettingsBlock = ( { todosData, className = '' } ) => {
if ( todosData.length === 0 ) {
return null;
}
return (
<div
className={ `ppcp-r-settings-block__todo ppcp-r-todo-items ${ className }` }
>
2025-01-03 16:49:38 +01:00
{ todosData
2025-01-07 12:18:24 +01:00
.slice( 0, 5 )
2025-01-03 16:49:38 +01:00
.filter( ( todo ) => {
return ! todo.isCompleted();
} )
.map( ( todo ) => (
<TodoItem
key={ todo.id }
title={ todo.title }
onClick={ todo.onClick }
/>
) ) }
</div>
);
};
const TodoItem = ( props ) => {
return (
2025-01-03 12:11:31 +01:00
<div className="ppcp-r-todo-item" onClick={ props.onClick }>
<div className="ppcp-r-todo-item__inner">
2024-12-11 09:23:01 +01:00
<div className="ppcp-r-todo-item__icon"></div>
<div className="ppcp-r-todo-item__description">
2025-01-03 11:21:26 +01:00
{ props.title }
</div>
</div>
</div>
);
};
export default TodoSettingsBlock;