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

Initial commit of SendLessonDialog #37358

Merged
merged 4 commits into from
Oct 23, 2020

Conversation

jamescodeorg
Copy link
Contributor

@jamescodeorg jamescodeorg commented Oct 20, 2020

This change contains an initial commit of the "send lesson" dialog. The layout should be more or less finished (except where noted). Functionality will be added in future commits.

I've added the new dialog to storyboard. Let me know if there are other tests that I should write.

I haven't written much front-end code before so thanks in advance for keeping me out of trouble!

Links

Testing story

Reviewer Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

Without Google button:
Screen Shot 2020-10-20 at 4 24 34 PM

With (placeholder) Google button:
Screen Shot 2020-10-20 at 4 15 34 PM

showGoogleButton: PropTypes.bool
};

render() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not required, but convention: The render function is usually the last one in the class.

}
}

const styles = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Convention: The styles object generally goes before the class declaration

</a>
</div>
{this.renderCopyToClipboardRow()}
{this.props.showGoogleButton && this.renderShareToGoogleRow()}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if you're at the point where you want to start writing tests yet, but if you are, this would be a good case to unit test.
Example:

it('displays warning message', () => {
const wrapper = shallow(
<StudentSelector students={students} handleSubmit={() => {}} />
);
expect(wrapper.find('p')).to.have.lengthOf(0);
wrapper.setState({selectedStudentIds: [1, 2, 3, 4]});
expect(wrapper.find('p')).to.have.lengthOf(1);
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the pointer -- I will add this test to check for the google button when I put in the real implementation of the button.

@jamescodeorg
Copy link
Contributor Author

This is ready for re-review! I did run into a pretty annoying problem with required props and the ExampleDialogButton that is similar to the issue described here. After spending some time on it, I decided to just make the props not required for now and will revisit later if I have time. (As a workaround, I also tried to remove ExampleDialogButton and just render the dialog directly in storybook using the hideBackdrop property but the DialogFooter component is written in such a way that it doesn't render correctly with hideBackdrop.)

Copy link
Contributor

@jmkulwik jmkulwik left a comment

Choose a reason for hiding this comment

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

Looks great!

@jamescodeorg jamescodeorg merged commit 821fbff into staging Oct 23, 2020
@jamescodeorg jamescodeorg deleted the jamescodeorg/send-lesson-dialog-1 branch October 23, 2020 17:12
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.

None yet

2 participants