Skip to content

Commit

Permalink
iconos y otros
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaap2099 committed Aug 7, 2023
1 parent f383a50 commit 2a4a088
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 38 deletions.
14 changes: 14 additions & 0 deletions src/CompleteIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
import { TodoIcon } from './TodoIcon';

function CompleteIcon ({completed, onComplete}) {
return (
<TodoIcon
type = "check"
color= {completed ? 'green' : 'gray' }
onClick={onComplete}
/>
);
}

export { CompleteIcon };
14 changes: 14 additions & 0 deletions src/DeleteIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
import { TodoIcon } from './TodoIcon';

function DeleteIcon ({onDelete}) {
return (
<TodoIcon
type = "delete"
color= "gray"
onClick={onDelete}
/>
);
}

export { DeleteIcon };
42 changes: 42 additions & 0 deletions src/TodoIcon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.Icon {
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
height: 48px;
width: 48px;
font-size: 24px;
font-weight: bold;
}

.Icon-container-check {
position: absolute;
left: 12px;
}
.Icon-container-check--active {
color: #4caf50;

}

.Icon-container-delete {
position: absolute;
top: -24px;
right: 0;
}

.Icon-container-delete:hover {
color: red;
}

.Icon-svg {
width: 24px;
height: 24px;
}

.Icon-container-delete:hover .Icon-svg {
fill: red;
}

.Icon-container-check:hover .Icon-svg {
fill: green;
}
20 changes: 20 additions & 0 deletions src/TodoIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ReactComponent as CheckSVG } from './check.svg';
import { ReactComponent as DeleteSVG } from './delete.svg';
import './TodoIcon.css'

const iconTypes = {
"check": (color) => <CheckSVG className='Icon-svg' fill={color} />,
"delete": (color) => <DeleteSVG className='Icon-svg' fill={color} />,
}

function TodoIcon({ type, color, onClick }) {
return (
<span
className={`Icon-container Icon-container-${type}`}
onClick={onClick}>
{iconTypes[type](color)}
</span>
);
}

export {TodoIcon}
29 changes: 0 additions & 29 deletions src/TodoItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,3 @@
text-decoration: line-through;
}

.Icon {
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
height: 48px;
width: 48px;
font-size: 24px;
font-weight: bold;
}

.Icon-check {
position: absolute;
left: 12px;
}
.Icon-check--active {
color: #4caf50;

}

.Icon-delete {
position: absolute;
top: -24px;
right: 0;
}

.Icon-delete:hover {
color: red;
}
20 changes: 11 additions & 9 deletions src/TodoItem.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { CompleteIcon } from './CompleteIcon';
import { DeleteIcon } from './DeleteIcon';
import './TodoItem.css'
function TodoItem(props) {
return (
<li className="TodoItem">
<span className={`Icon Icon-check ${props.completed && "Icon-check--active"}`}
onClick={props.onComplete}
>
V
</span>
<CompleteIcon
completed={props.completed}
onComplete={props.onComplete}
/>

<p className={`TodoItem-p ${props.completed && "TodoItem-p--complete"}`} >{props.text}</p>
<span className="Icon Icon-delete"
onClick={props.onDelete} >
X
</span>
<DeleteIcon
onDelete={props.onDelete}
/>

</li>
);
}
Expand Down
7 changes: 7 additions & 0 deletions src/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2a4a088

Please sign in to comment.