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

Refactor Quick Actions for tables #18535

Merged
merged 8 commits into from Oct 21, 2017
Merged

Refactor Quick Actions for tables #18535

merged 8 commits into from Oct 21, 2017

Conversation

caleybrock
Copy link
Contributor

@caleybrock caleybrock commented Oct 20, 2017

Refactored the quick action cell components I made for the PersonalProjectsTable (still only in storybook) a while back to be something that can be used in any table, with any set of actions. I also added it to the ManageStudentsTable, which is in active development.

I know @epeach is currently working on adding some actions to the SectionsTable, and while she copied the styles from the old version of this component, she could not use it because it was not general enough. Hopefully this makes things a little cleaner for both of us.
Erin, I'm happy to pair with you when you're back to get our code down to one version of this component. I think our main difference is the implementation of how the box actually pops up and gets dismissed, so we should probably take a look at both and see which one feels smoother. For now though, this unblocks me.

Stand alone video:
quickactionscell

Screenshots (both only in storybook):
ManageStudentsTable
screen shot 2017-10-20 at 10 14 26 am
PersonalProjectsTable
screen shot 2017-10-20 at 10 15 19 am

<ProjectActionBox isPublished={rowData.isPublished}/>
<QuickAction
text={i18n.rename()}
action={()=>{}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This table isn't done and is currently only in storybook, adding placeholder actions for now.

Copy link
Member

Choose a reason for hiding this comment

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

this is fine for a placeholder. once you have actual functions in here, you'll want to define them outside the render method so that we don't re-bind to this on every render

text={i18n.remix()}
action={()=>{}}
/>
{this.props.isPublished &&
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These lines when the published flag determines what children to show seems to cause an error, but I've vet to figure out why.

Error: Call to console.error from "Already published project": Warning: Failed prop type: Invalid prop `children[3]` of type `boolean` supplied to `QuickActionsBox`, expected a single ReactElement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I see, you can't have a function as a child. Will update.

@caleybrock
Copy link
Contributor Author

@davidsbailey Fixed that test so this should be ready for review now, thanks!

@davidsbailey
Copy link
Member

👀 looking...

Copy link
Member

@davidsbailey davidsbailey left a comment

Choose a reason for hiding this comment

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

Nice improvement, Caley!

<ProjectActionBox isPublished={rowData.isPublished}/>
<QuickAction
text={i18n.rename()}
action={()=>{}}
Copy link
Member

Choose a reason for hiding this comment

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

this is fine for a placeholder. once you have actual functions in here, you'll want to define them outside the render method so that we don't re-bind to this on every render

@@ -8,7 +8,7 @@ import wrappedSortable from '../tables/wrapped_sortable';
import orderBy from 'lodash/orderBy';
import {PROJECT_TYPE_MAP, personalProjectDataPropType} from './projectConstants';
import QuickActionsCell from '../tables/QuickActionsCell';
import ProjectActionBox from './ProjectActionBox';
import QuickAction from '../tables/QuickAction';
Copy link
Member

Choose a reason for hiding this comment

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

after removing ProjectActionBox from this file, it looks like it is only used by ProjectCard.jsx (and it's own storybook entry). This seems fine, just confirming my understanding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's correct. Mostly just didn't want to remove any storybook functionality from the project card, and this is at least as good as it was before.

@caleybrock caleybrock merged commit 3cab7e9 into staging Oct 21, 2017
@caleybrock caleybrock deleted the quick-actions-box branch October 21, 2017 01:50
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