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

Foldable Card: Add border between summary and expand button if summary is included #2390

Merged
merged 4 commits into from
Jan 19, 2016

Conversation

alternatekev
Copy link
Contributor

During the discussions of #1477 and #1898, it's become clear that we could use a divider between the expand/collapse icon and the action button (if present) on a FoldableCard. This icon helps divide the disclosure icon from a potentially destructive action, like accidentally disabling your Twitter connection.

Instead of forcing every single instance of FoldableCard that has an action button to inherit this style, I'm adding an iconBorder prop to the component, the rendering of which looks like this:

screen shot 2016-01-13 at 1 07 40 pm

screen shot 2016-01-13 at 1 07 47 pm

cc @mtias @kellychoffman @folletto

… between open/close icon and action button to the left of it
@alternatekev alternatekev added Framework [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR Components labels Jan 13, 2016
@@ -55,6 +55,15 @@ module.exports = React.createClass( {
</p>
<p>
<FoldableCard
header="This is a FoldableCard with iconBorder"
iconBorder={ true }
summary={ <button className="button">Update</button> }
Copy link
Member

Choose a reason for hiding this comment

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

Could we just render the border if there's content in summary?

@alternatekev
Copy link
Contributor Author

@mtias

Could we just render the border if there's content in summary?

We could but this forces every FoldableCard to inherit this style, which I'm comfortable doing if others are ok with it.

@mtias
Copy link
Member

mtias commented Jan 13, 2016

It would be every FoldableCard that has content to display on that right side, otherwise it remains with no border. I think it's a fair expectation and makes it a bit easier to use (instead of having to decide case by case). If there's content to the right, we render border, otherwise we don't.

@alternatekev
Copy link
Contributor Author

@mtias I went ahead and removed the iconBorder prop and instead based the has-border className on whether there's a summary prop. I can't find a ton of examples of it in use like this, but the one I could find visually was this, which seemed to work well:

screen shot 2016-01-13 at 3 28 22 pm

screen shot 2016-01-13 at 3 28 27 pm

@alternatekev alternatekev changed the title Foldable Card: Add iconBorder prop Foldable Card: Add border between summary and expand button if summary is included Jan 13, 2016
@alternatekev
Copy link
Contributor Author

Also here, on all sites/single plugin view:

screen shot 2016-01-13 at 3 47 24 pm

screen shot 2016-01-13 at 3 47 16 pm

...although it doesn't seem super appropriate that it's showing up here?

@kellychoffman
Copy link
Member

...although it doesn't seem super appropriate that it's showing up here?

Its only supposed to show when there's a button, right?

@alternatekev
Copy link
Contributor Author

@kellychoffman It's now basing the line on whether the summary prop is used, as suggested by @mtias, but the summary is being used here to pass a PluginUpdateIndicator on this line:

https://github.com/Automattic/wp-calypso/blob/master/client/my-sites/plugins/plugin-site-jetpack/index.jsx#L57

@kellychoffman
Copy link
Member

Okay. I don't think its bad, just doesn't seem needed.

@alternatekev
Copy link
Contributor Author

Agreed. We can probably update that (little-seen) plugins component to not use the summary prop?

@alternatekev
Copy link
Contributor Author

This is what it looks like with the Updater component showing:

untitled-1
untitled-2

we can refactor it after the FoldableCard is updated, and have it only pass in the summary prop when there's actually an update, instead of using it every time, update or no. (and obviously, the top one would lose the border in that process) (and we can fix the margin on the button which is weird and unrelated)

@kellychoffman
Copy link
Member

Makes sense.

@alternatekev alternatekev removed [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 14, 2016
@alternatekev alternatekev reopened this Jan 14, 2016
@alternatekev alternatekev added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 14, 2016
@alternatekev
Copy link
Contributor Author

Once everything is merged and a tiny css update is made, it'll look like this on sharing @kellychoffman

screen shot 2016-01-14 at 2 43 03 pm

@kellychoffman
Copy link
Member

Once everything is merged and a tiny css update is made, it'll look like this on sharing @kellychoffman

I dig it.

@alternatekev
Copy link
Contributor Author

Pinging @dmsnell for code review

@@ -41,7 +41,7 @@ var FoldableCard = React.createClass( {
onClose: noop,
cardKey: '',
icon: 'chevron-down',
isExpanded: false
isExpanded: false,
Copy link
Member

Choose a reason for hiding this comment

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

is this a typo?

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought it was good practice to end all lines in objects with a comma to avoid double-line diffs when a single line gets added (clarity) and making all the lines uniform.

Copy link
Member

Choose a reason for hiding this comment

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

I couldn't find this explicit in our style guide. There was one example that included a list and it had the trailing comma. Most of the time I see them I feel like the don't have the trailing comma, but Babel handles it gracefully, so maybe this boils down to personal preference here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typo, since I had an extra prop defined at first, which I removed. I'll remove the comma here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@dmsnell
Copy link
Member

dmsnell commented Jan 15, 2016

@alternatekev I don't know exactly what summary means, but I like the way of automatically setting this attribute instead of relying on a prop. I'm not against these kinds of boolean props, but I think that if it's true in 95%+ of the cases we use in Calypso, then just making that the default behavior is great.

@alternatekev
Copy link
Contributor Author

Adding screenshots of more screens that will update with this merge:

Exporter:
screen shot 2016-01-18 at 3 25 22 pm

@dmsnell
Copy link
Member

dmsnell commented Jan 18, 2016

:shipit:

@dmsnell dmsnell added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 18, 2016
alternatekev added a commit that referenced this pull request Jan 19, 2016
Foldable Card: Add border between summary and expand button if summary is included
@alternatekev alternatekev merged commit ae62261 into master Jan 19, 2016
@alternatekev alternatekev deleted the add/foldable-card-icon-border branch January 19, 2016 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants