Skip to content

Solution: Jonathan Cedeño & Alfonso García #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

jonathancede
Copy link

No description provided.

@danilucaci danilucaci self-requested a review May 28, 2021 11:02
Copy link
Contributor

@danilucaci danilucaci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy buen proyecto! Felicidades! Seguimos 💪


this.state = {
tasks: [],
isDark: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy buen uso de la propiedad de estado para indicar el dark mode! Como mejora se podría usar un nombre más descriptivo como isDarkModeActive.

Comment on lines +72 to +86
handleDeleteTask(event, taskId) {
const { tasks } = this.state;

const updatedTasks = tasks.filter((task) => task.id !== taskId);

this.setState({ tasks: updatedTasks });
}

handleClearCompleted() {
const { tasks } = this.state;

const updatedTasks = tasks.filter((task) => !task.isCompleted);

this.setState({ tasks: updatedTasks });
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy limpio y bien implementado 👏🏻👏🏻

if (task.id === taskId) {
return {
...task,
isEditing: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy interesante la solución para indicar que el todo está siendo editado actualmente.

Comment on lines +147 to +151
toggleDarkLightMode() {
const { isDark } = this.state;
if (isDark === true) this.setState({ isDark: false });
else this.setState({ isDark: true });
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy bien implementado!

Como mejora podríais usar el patrón de functional updates:

this.setState((prevState) => ({
  isDark: !prevState.isDark,
}));

Comment on lines +8 to +11
this.state = {
isChecked: props.defaultChecked,
taskId: props.taskId,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No es recomendable inicializar el state basandose props ya que puede generar muchos bugs. Una solución más sencilla es pasar los props de checked o taskId desde el componente padre y en el componente Checkbox usar el spread operador para pasar todos los props.

<input
    type="checkbox"
    onChange={this.toggleChange}
/>

Comment on lines +10 to +11
if (isDark === true) mode = <img className="icon" src={SUN_PATH} alt="Sun" />;
else mode = <img className="icon" src={MOON_PATH} alt="Moon" />;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Los bloques if o else se deberían incluir siempre con los símbolos {} para una mejor legibilidad y para evitar que el largo de línea no pase de los 72 caracteres recomendados.

Comment on lines +6 to +26
main {
height: 85vh;
}
.list-header {
height: 20vh;
margin-bottom: 2vh;
}
.main-list {
padding-top: 7vh;
padding-bottom: 5vh;
margin: 0 auto;
width: 90vw;
max-width: 800px;
}

.camouflaged-button {
background-color: transparent;
border: 0;
}

.list-container {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debería haber un espaciado más uniforme entre las clases, es decir, tener un salto de línea entre cada bloque de definición de estilos.


function NewTask({ saveNewTask }) {
return (
<>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En este caso no haría falta tener el Fragment dado que el componente Formik ya es un container.

Comment on lines +1 to +28
.form-wrapper {
box-shadow: rgb(16 16 16 / 60%) 0 8px 30px;
border-radius: 8px;
background-color: white;
}

.isCompleted-wrapper {
height: 75px;
width: 75px;
}

.check-new-task {
position: relative;
left: -14px;
top: -14px;
}

.text-input-wrapper {
height: 40px;
width: 100%;
padding-right: 15px;
}

.text-input {
width: 100%;
border: none;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy buen ejemplo de cómo poner un salto de línea entre cada bloque de CSS 👏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants