Pocket / curation-tools-frontend

DEPRECATED
Mozilla Public License 2.0
10 stars 52 forks source link

Create edit and approve page component #90

Closed nina-py closed 3 years ago

nina-py commented 3 years ago

Implementation details

Closes #70. Closes #93.

Buttons

Quite a bit of work went into theming the buttons and updating components to use the new buttons as each component styled the buttons in its own way thing prior to this change. I have had to update the layout of some of these components (i.e. the login form) as well to match the screenshots supplied in completed issues.

At the moment, App.tsx contains all four components affected so that the changes can easily be reviewed. These are the new EditAndApproveStory component, AddStory, Card, and LoginForm. The Header component also uses the new buttons but more work is needed there - the way it's set up right now it's not taking advantage of Material UI's responsive styles. This should probably be addressed in a separate PR.

This is how buttons can be styled in the app now with the custom Button component:

// Positive (default), i.e. "Approve":
<Button>Approve</Button>
// or, if explicitly defining the type:
<Button buttonType="positive">Approve</Button>

// Negative, i.e. "Reject":
<Button buttonType="negative">Reject</Button>

// Neutral, i.e. "Snooze":
<Button buttonType="neutral">Snooze</Button>

// Hollow, i.e. "Log Out":
<Button buttonType="hollow">Log Out</Button>

//Neutral & hollow, i.e. "Cancel":
<Button buttonType="hollow-neutral">Cancel</Button>
nina-py commented 3 years ago

For the switch component, I have adapted styles from an AirBnB-inspired switch here: https://mui-treasury.com/styles/switch/ (GitHub: https://github.com/siriwatknp/mui-treasury). It's mostly fine but it is off by one (!) pixel in the "on" position. I will hunt this down later; for now I think it's good to go as is.

Just the props/tests remaining, not much left to do in this PR.

nina-py commented 3 years ago

Just a note that tests are passing but output is flooded with warnings identical to the ones mentioned here: https://github.com/testing-library/dom-testing-library/issues/774. The suggested fix doesn't fix the warnings for me but I will look into it in more detail over the coming days.

nina-py commented 3 years ago

All issues with the tests and the Switch component styles have been fixed. Please review - I think this is good to go. All affected components (Card, AddStory, EditAndApproveStory, and LoginForm) are rendered on the home page temporarily. Header is also using the updated buttons but needs refactoring to use MUI Grid components, so please forgive the misalignment of some elements for now.

kkyeboah commented 3 years ago

@nina-py Why do we have all the components rendered in App.tsx, is that intended to stay or just for demo on the PR

nina-py commented 3 years ago

@kkyeboah, yes, that is just to demo the new form and all the other components that use the custom Button component. I can remove those now that you've reviewed everything?

kkyeboah commented 3 years ago

@kkyeboah, yes, that is just to demo the new form and all the other components that use the custom Button component. I can remove those now that you've reviewed everything?

Cool, let's do that.

nina-py commented 3 years ago

Cool, let's do that.

Done.

nina-py commented 3 years ago

Thank you @kkyeboah!