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

[Card] Revert change to footer button alignment, add new footerActionAlignment prop #2407

Merged
merged 1 commit into from Nov 26, 2019

Conversation

qq99
Copy link
Contributor

@qq99 qq99 commented Nov 6, 2019

Reverts #2104
See #2075 for more context on this change

WHY are these changes introduced?

It seemed to be generally accepted that this change is rendering buttons strangely, as seen in #2075 (comment).

Screen Shot 2019-09-26 at 11 35 12 AM

After the PR I am reverting, polaris-react renders secondary buttons on the left, then primary buttons, which is contrary to the expected Primary > Secondary reading order. The blue button should be on the left.

So, I set out to revert this change (because every consumer of Card would be expecting right-aligned buttons prior to that change, IMO that was a breaking change), and give the ability to control alignment.

WHAT is this pull request doing?

Final product:
Screen Shot 2019-11-06 at 11 02 40 AM

  • Adds new footerActionAlignment prop to <Card> to control the overall left/right alignment. Default to right for historical consumers

How to 🎩

Copy-paste this code in playground/Playground.tsx:
import React from 'react';
import {Page, Card} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      <Card
        title="Card with right-aligned footer actions"
        primaryFooterAction={{content: 'Do a thing'}}
        secondaryFooterActions={[
          {content: 'Do another thing'},
          {content: 'Do a third thing'},
        ]}
        sectioned
      >
        Some copy
      </Card>
      <Card
        title="Card with left-aligned footer actions"
        primaryFooterAction={{content: 'Do a thing'}}
        secondaryFooterActions={[
          {content: 'Do another thing'},
          {content: 'Do a third thing'},
        ]}
        footerActionAlignment="left"
        sectioned
      >
        Some copy
      </Card>
    </Page>
  );
}

🎩 checklist

@qq99 qq99 changed the title [Card][ButtonGroup] Revert change to footer button alignment, add new footerActionAlignment prop [wip][Card][ButtonGroup] Revert change to footer button alignment, add new footerActionAlignment prop Nov 6, 2019
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2019

💦 Potential splash zone of changes introduced to src/**/*.tsx in this pull request:

Files modified5
Files potentially affected4

Details

All files potentially affected (total: 4)
📄 UNRELEASED.md (total: 0)

Files potentially affected (total: 0)

🎨 src/components/Card/Card.scss (total: 4)

Files potentially affected (total: 4)

🧩 src/components/Card/Card.tsx (total: 3)

Files potentially affected (total: 3)

📄 src/components/Card/README.md (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Card/tests/Card.test.tsx (total: 0)

Files potentially affected (total: 0)


This comment automatically updates as changes are made to this pull request.
Feedback, troubleshooting: open an issue or reach out on Slack in #polaris-tooling.

@qq99 qq99 changed the title [wip][Card][ButtonGroup] Revert change to footer button alignment, add new footerActionAlignment prop [Card][ButtonGroup] Revert change to footer button alignment, add new footerActionAlignment prop Nov 6, 2019
@qq99 qq99 force-pushed the card-button-fixes branch 3 times, most recently from 8322d6c to fbf4738 Compare November 7, 2019 16:09
Copy link
Contributor

@rexmac rexmac left a comment

Choose a reason for hiding this comment

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

👍 Thanks for this! 👏

@qq99 qq99 requested a review from mitchmaps November 15, 2019 18:11
Copy link
Contributor

@mitchmaps mitchmaps left a comment

Choose a reason for hiding this comment

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

LGTM 👍 🔥

@qq99 qq99 force-pushed the card-button-fixes branch 2 times, most recently from e2d43bb to 1d2305a Compare November 18, 2019 16:31
Copy link
Contributor

@yourpalsonja yourpalsonja left a comment

Choose a reason for hiding this comment

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

This LGTM. 👍

Reading #2075, it seems like we still haven't come to a consensus on how the pattern should actually exist in the admin.

@qq99 would you want to schedule an office hours with a designer from the Polaris team and me?

@qq99 qq99 force-pushed the card-button-fixes branch 2 times, most recently from 58df5e2 to 80500b9 Compare November 22, 2019 14:30
@qq99
Copy link
Contributor Author

qq99 commented Nov 22, 2019

Hi all, I chatted with @dpersing who recommended we actually change DOM order in this case

A good example was for partially sighted users who would:

  • visually see buttons in 1 order
  • hear buttons read in the opposite order
    => confusion

I've updated the PR to change the DOM order as a result (previously it was CSS flex to change visual order)

@qq99 qq99 force-pushed the card-button-fixes branch 3 times, most recently from f0f9763 to 082fa90 Compare November 26, 2019 17:52
…Alignment prop (left | right), default to right for backwards compat
@@ -17,10 +18,10 @@
- Fixed an issue where the dropzone component jumped from an extra-large layout to a layout based on the width of its container ([#2412](https://github.com/Shopify/polaris-react/pull/2412))
- Fixed an issue which caused HSL colors to not display in Edge ([#2418](https://github.com/Shopify/polaris-react/pull/2418))
- Changed Button's `disclosure` prop to be `boolean | "up" | "down"`, allowing greater control over the direction the disclosure caret faces ([#2431](https://github.com/Shopify/polaris-react/pull/2431))
- Fixed an issue where the dropzone component jumped from an extra-large layout to a layout based on the width of it's container ([#2412](https://github.com/Shopify/polaris-react/pull/2412))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a dupe of this above

@qq99 qq99 merged commit bf52cc8 into master Nov 26, 2019
@qq99 qq99 deleted the card-button-fixes branch November 26, 2019 18:19
@qq99 qq99 changed the title [Card][ButtonGroup] Revert change to footer button alignment, add new footerActionAlignment prop [Card] Revert change to footer button alignment, add new footerActionAlignment prop Nov 26, 2019
@dleroux dleroux temporarily deployed to production December 4, 2019 14:42 Inactive
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

5 participants