Skip to content

Commit

Permalink
add Styles to the Icons
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanDaGue committed Aug 28, 2024
1 parent 7cf5f20 commit e11d2a8
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function App() {
)

const TodoComplet = (text) =>{
console.log('Complete')
const newTodos=[...todos]
const todoIndex = newTodos.findIndex(
elem => elem.text== text
Expand All @@ -45,6 +46,7 @@ function App() {
setTodos(newTodos);
}
const TodoDelet = (text)=>{
console.log('Delete')
const newTodos=[...todos]
const todoIndex = newTodos.findIndex(
elem => elem.text== text
Expand Down
21 changes: 21 additions & 0 deletions src/IconCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";
import {TodoIcon} from './TodoIcon';
function IconCheck({onComplete}){
return (
<TodoIcon
type="check"
onClick={onComplete}
/>
)
}
export {IconCheck}



// import React from 'react';import{TodoIcon}from './TodoIcon';

// function CompleteIcon({completed,onComplete}){return(<TodoIcon
// type="check"
// color={completed?'green':'gray'}
// onClick={onComplete}/>);}
// export{CompleteIcon};
11 changes: 11 additions & 0 deletions src/IconDelete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import {TodoIcon} from "./TodoIcon";
function IconDelete({onDelete}){
return (
<TodoIcon
type="delete"
onClick={onDelete}
/>
)
}
export {IconDelete}
1 change: 1 addition & 0 deletions src/Icons/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/Icons/complete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/Icons/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/TodoIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from "react";
import { ReactComponent as CheckSVG} from './Icons/check.svg'
import { ReactComponent as DeleteSVG} from './Icons/delete.svg'

const iconTypes={"check":<CheckSVG/>,"delete":<DeleteSVG/>,}
function TodoIcon({type, onClick}){
return(
<span className={`Icon Icon-svg Icon-${type}`} onClick={onClick} >
{iconTypes[type]}
</span>
)
}
export {TodoIcon};



// 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};
27 changes: 21 additions & 6 deletions src/TodoItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,32 @@ p {
color: #555;
}

.Icon-check-active{
background-color:beige;
.Icon-check-active {
background-color: beige;
}
.Icon-check-active .Icon-check{
.Icon-check-active .Icon-check {
color: aquamarine;
}

.Icon-check-active .Icon-svg {
fill: aquamarine;
}
.Icon-svg {
fill: #caa275;
}
.Icon {
cursor: pointer;
}

.inactive{
.inactive {
display: none;
}

/* New hover effect and transition */
.Icon:hover .Icon-svg {
fill: aquamarine; /* Change to your desired hover color */
transition: fill 0.3s ease; /* Smooth transition */
}

.Icon:hover .Icon-check {
color: aquamarine; /* Change to your desired hover color */
transition: color 0.3s ease; /* Smooth transition */
}
12 changes: 9 additions & 3 deletions src/TodoItem.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import "./TodoItem.css"
import { IconCheck } from './IconCheck'
import { IconDelete } from './IconDelete'

function TodoItem(props){
return(
<li className={`TodoIteM ${props.completed && "Icon-check-active"}`}>
<span className={`Icon Icon-check`} onClick={props.onComplete}> V </span>
{/* <span className={`Icon Icon-check`} onClick={props.onComplete}> V </span> */}
<IconCheck onComplete={props.onComplete}/>
<p className={`TodoItem-p TodoItem-p--complete`}>{props.text}</p>
<span className='Icon Icon-delete' onClick={props.onDelete}>X </span>
<IconDelete onDelete={props.onDelete}/>

{/* <span className='Icon Icon-delete' onClick={props.onDelete}>X </span> */}
</li>
);
}
export { TodoItem};
export { TodoItem};

0 comments on commit e11d2a8

Please sign in to comment.