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

[BulkActions] Add theming to BulkAction and remove custom ButtonGroup from ResourceList #2467

Merged
merged 1 commit into from
Nov 27, 2019

Conversation

dleroux
Copy link
Contributor

@dleroux dleroux commented Nov 25, 2019

WHY are these changes introduced?

partly addresses: https://github.com/Shopify/polaris-ux/issues/360 and https://github.com/Shopify/polaris-ux/issues/361

While applying the design language to ButtonGroup, we were able to change how ButtonGroups work. This allowed us to refactor the ResourceList BulkActions and remove the custom components.

BulkActions

WHAT is this pull request doing?

  1. applies design language
  2. makes use of Buttongroups
  3. removes the need for custom BulkAction buttons

How to 🎩

To 🎩 ensure BulkActions are working as expected in Storybook. Including small screen, and select mode.

Also use yarn build-consumer web

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

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}

🎩 checklist

@dleroux dleroux changed the base branch from master to buttongroup-context November 25, 2019 20:49
@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2019

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

Files modified12
Files potentially affected4

Details

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

Files potentially affected (total: 0)

🎨 src/components/ResourceItem/ResourceItem.scss (total: 2)

Files potentially affected (total: 2)

🧩 src/components/ResourceList/ResourceList.tsx (total: 0)

Files potentially affected (total: 0)

🎨 src/components/ResourceList/components/BulkActions/BulkActions.scss (total: 2)

Files potentially affected (total: 2)

🧩 src/components/ResourceList/components/BulkActions/BulkActions.tsx (total: 1)

Files potentially affected (total: 1)

🧩 src/components/ResourceList/components/BulkActions/components/BulkActionButton/BulkActionButton.tsx (total: 2)

Files potentially affected (total: 2)

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

Files potentially affected (total: 0)

🎨 src/components/ResourceList/components/CheckableButton/CheckableButton.scss (total: 3)

Files potentially affected (total: 3)

🧩 src/components/ResourceList/components/CheckableButton/CheckableButton.tsx (total: 2)

Files potentially affected (total: 2)

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

Files potentially affected (total: 0)

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

Files potentially affected (total: 0)

📄 tests/build.test.js (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.

@dleroux dleroux force-pushed the buttongroup-context branch 2 times, most recently from 337cccd to 12714f4 Compare November 26, 2019 12:52
@dleroux dleroux force-pushed the cs-bulkactions branch 2 times, most recently from 1085809 to 7aec9fb Compare November 26, 2019 18:10
@dleroux dleroux changed the base branch from buttongroup-context to master November 26, 2019 18:11

// We need the first item of button group on small screen to fill the space
// stylelint-disable selector-max-specificity, selector-max-class
@include breakpoint-before(resource-list(breakpoint-small)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Our fullWidth makes every button equal width. On a small screen, bulk actions require only the checkable button to extend the full width.

We toyed with the idea of adding a prop to ButtonGroup which was confusing and this being the only use case where we have seen this we decided to move forward with this approach. We added a test to ensure that if ever there's mark-up change, this will be flagged.

This is the trade-off of being able the use ButtonGroup and allowing us to remove quite a bit of custom components.

@dleroux dleroux force-pushed the cs-bulkactions branch 2 times, most recently from 34ca7a1 to d5085d9 Compare November 26, 2019 18:21
@dleroux dleroux changed the title [WIP] Add theming to BulkAction and remove custom ButtonGroup from ResourceList [WIP][BulkActions] Add theming to BulkAction and remove custom ButtonGroup from ResourceList Nov 26, 2019
@dleroux dleroux changed the title [WIP][BulkActions] Add theming to BulkAction and remove custom ButtonGroup from ResourceList [BulkActions] Add theming to BulkAction and remove custom ButtonGroup from ResourceList Nov 26, 2019
@dleroux dleroux changed the title [BulkActions] Add theming to BulkAction and remove custom ButtonGroup from ResourceList [WIP][BulkActions] Add theming to BulkAction and remove custom ButtonGroup from ResourceList Nov 26, 2019
@dleroux
Copy link
Contributor Author

dleroux commented Nov 26, 2019

fixing failing tests.

@dleroux
Copy link
Contributor Author

dleroux commented Nov 26, 2019

The code cov is complaining about unstableGlobalTheming && styles.globalTheming, Are we ignoring these? @tmlayton

@tmlayton
Copy link
Contributor

tmlayton commented Nov 27, 2019

We have been adding tests if using the features hook

@@ -6,23 +6,6 @@ $bulk-actions-button-stacking-order: (
);
$bulk-actions-offset-slide-in-start: rem(-40px);

.Button {
@include text-style-button;
@include button-base;
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

&:focus {
z-index: 1;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

@include recolor-icon(color('ink', 'lightest'));
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@danrosenthal
Copy link
Contributor

danrosenthal commented Nov 27, 2019

Your ButtonGroup modifications really unlocked some powerful changes here. Nice work.

Noticing that the checkable button icon is colored as a normal icon. That makes sense since we don't have indigo in the pallet any longer, but it makes it invisible in dark mode since the CheckBox component isn't converted to use the color system yet. It might be worth just leaving the icon with the non-global-theming styles (leaving it indigo) until we convert Checkbox, so things don't appear broken.

@dleroux dleroux requested a review from danrosenthal November 27, 2019 14:31
@dleroux dleroux changed the title [WIP][BulkActions] Add theming to BulkAction and remove custom ButtonGroup from ResourceList [BulkActions] Add theming to BulkAction and remove custom ButtonGroup from ResourceList Nov 27, 2019
@dleroux
Copy link
Contributor Author

dleroux commented Nov 27, 2019

Yes it did unlock quite a bit. It's also allowing to remove ToggleButton in web and all the custom stuff associated with the RTE toolbar.

You are right, the checkbox will get branded automatically when we apply the branding.

This is ready for review 🙏

Copy link
Contributor

@danrosenthal danrosenthal left a comment

Choose a reason for hiding this comment

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

Nice work!

@dleroux dleroux merged commit 7036601 into master Nov 27, 2019
@dleroux dleroux deleted the cs-bulkactions branch November 27, 2019 15:35
@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.

3 participants