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

Item form modal #17

Merged
merged 15 commits into from
Sep 9, 2019
Merged

Item form modal #17

merged 15 commits into from
Sep 9, 2019

Conversation

allishultes
Copy link
Contributor

@allishultes allishultes commented Sep 2, 2019

Is your Pull Request request related to another issue in this repository ?

Issue #7
Issue #10

Describe what the PR does

Adds the ItemForm and FormModal components to the Storybook. Both have been refactored using React Hooks.

The ItemForm has one story: Edit Project. It:

  • Takes a title (string) and description (string) as inputs
  • Validates the title and does not allow a project to be saved without one
  • Logs an 'Item Saved' action when a valid project is saved

The ItemFormModal component has two stories: Edit Project and New Project. The Edit Project story includes an ItemForm component that is passed a title, description and id from the FormModal component. The New Project story does not pas ItemForm an id, title or description. In both cases, the modal:

  • Has a 'close' button which closes the modal;
  • Displays the ItemForm component

The PR also changes the folder structure for the List and Search Bar components for kicks and giggles.

State whether the PR is ready for review or whether it needs extra work

Almost ready for review (where does the new project id come from?).

Additional context

@allishultes allishultes marked this pull request as ready for review September 2, 2019 13:09
@allishultes allishultes requested a review from emettely September 2, 2019 13:09
@allishultes allishultes added the generic component A non-workspace component for the storybook label Sep 2, 2019
packages/components/FormModal/ItemForm/index.js Outdated Show resolved Hide resolved
packages/components/FormModal/ItemForm/index.js Outdated Show resolved Hide resolved
packages/components/FormModal/ItemForm/index.js Outdated Show resolved Hide resolved
packages/components/FormModal/ItemForm/index.js Outdated Show resolved Hide resolved
packages/components/FormModal/ItemForm/index.js Outdated Show resolved Hide resolved
packages/components/FormModal/index.js Outdated Show resolved Hide resolved
Copy link
Contributor

@emettely emettely left a comment

Choose a reason for hiding this comment

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

Almost there :)

const editedProject = {
title: title,
description: description,
id: props.id
};

props.handleSaveForm(editedProject);
}
} else if (!isValidated) {
setIsValidated(true);
Copy link
Contributor

@emettely emettely Sep 9, 2019

Choose a reason for hiding this comment

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

setIsValidated(true); needs to happen for both cases - see line 20 + 24 in the previous version.

packages/components/FormModal/index.js Outdated Show resolved Hide resolved
@allishultes allishultes merged commit a63a9d2 into master Sep 9, 2019
@allishultes allishultes deleted the item-form-modal branch September 9, 2019 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generic component A non-workspace component for the storybook
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants