2025-01-03 11:21:26 +01:00
|
|
|
const TodoSettingsBlock = ( { todosData, className = '' } ) => {
|
2024-12-08 09:33:49 +01:00
|
|
|
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
|
|
|
|
.slice( 0, 5 )
|
|
|
|
.filter( ( todo ) => {
|
|
|
|
return ! todo.isCompleted();
|
|
|
|
} )
|
|
|
|
.map( ( todo ) => (
|
|
|
|
<TodoItem
|
|
|
|
key={ todo.id }
|
|
|
|
title={ todo.title }
|
|
|
|
onClick={ todo.onClick }
|
|
|
|
/>
|
|
|
|
) ) }
|
2024-12-08 09:33:49 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const TodoItem = ( props ) => {
|
|
|
|
return (
|
2025-01-03 12:11:31 +01:00
|
|
|
<div className="ppcp-r-todo-item" onClick={ props.onClick }>
|
2024-12-08 09:33:49 +01:00
|
|
|
<div className="ppcp-r-todo-item__inner">
|
2024-12-11 09:23:01 +01:00
|
|
|
<div className="ppcp-r-todo-item__icon"></div>
|
2024-12-08 09:33:49 +01:00
|
|
|
<div className="ppcp-r-todo-item__description">
|
2025-01-03 11:21:26 +01:00
|
|
|
{ props.title }
|
2024-12-08 09:33:49 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default TodoSettingsBlock;
|