Skip to content
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

add react movies list add form #2751

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ValentynaD
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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


Great job on implementing the core functionality of your application! 🎉 Your code meets the main requirements, and you've done well with handling form submissions, validation, and data preparation. While there are a few minor issues, such as variable naming and ensuring errors are not shown after clearing the form, these do not significantly impact the functionality. Keep up the good work, and consider refining these areas for even cleaner code in the future. Well done! 👏

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

@@ -1,16 +1,30 @@
import React, { useState } from 'react';
import './App.scss';
import { MoviesList } from './components/MoviesList';
import { NewMovie } from './components/NewMovie';
import moviesFromServer from './api/movies.json';

Choose a reason for hiding this comment

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

Ensure that the moviesFromServer import is correctly pointing to a valid JSON file. Verify that the JSON structure matches the Movie interface defined in this file.

return (
<div className="page">
<div className="page-content">
<MoviesList movies={moviesFromServer} />
<MoviesList movies={movies} />

Choose a reason for hiding this comment

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

Ensure that the MoviesList component is implemented to correctly handle the movies prop. It should expect an array of objects that match the Movie interface.

</div>
<div className="sidebar">
<NewMovie /* onAdd={(movie) => {}} */ />
<NewMovie onAdd={handleAddMovie} />

Choose a reason for hiding this comment

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

Ensure that the NewMovie component is implemented to correctly handle the onAdd prop. It should call this function with a new Movie object when a new movie is added.

<form className="NewMovie" key={count}>
<h2 className="title">Add a movie</h2>
<form onSubmit={handleSubmit} data-cy="new-movie-form">
<h2>Add a movie</h2>

<TextField

Choose a reason for hiding this comment

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

Ensure that the TextField component is implemented to correctly handle the props such as name, label, value, onChange, onBlur, and required. It should be able to display the input field with the correct label and handle user input and validation feedback.


{hasError && <p className="help is-danger">{`${label} is required`}</p>}
{hasError && (
<p className="help is-danger">{error || `${label} is required`}</p>

Choose a reason for hiding this comment

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

Ensure that the error prop is correctly passed from the parent component to display validation messages. This prop should contain any error message related to the input field, allowing the component to display it when necessary.

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

Successfully merging this pull request may close these issues.

2 participants