Skip to content

Conversation

@amorriscode
Copy link

WHY are these changes introduced?

Fixes #2961

Following up on a previous PR, the CheckableButton was being squished.

WHAT is this pull request doing?

This PR adds min-width: spacing(); to the CheckableButtonWrapper so it has a nice amount of space.

Before:

image

After:

image

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

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

import {Avatar, Card, ResourceItem, ResourceList, TextStyle} from '../src';

export function Playground() {
  const [sortValue, setSortValue] = useState('DATE_MODIFIED_DESC');

  const resourceName = {
    singular: 'customer',
    plural: 'customers',
  };

  const items = [
    {
      id: 341,
      url: 'customers/341',
      name: 'Mae Jemison',
      location: 'Decatur, USA',
    },
    {
      id: 256,
      url: 'customers/256',
      name: 'Ellen Ochoa',
      location: 'Los Angeles, USA',
    },
  ];

  return (
    <Card>
      <ResourceList
        selectable
        selectedItems={[]}
        resourceName={resourceName}
        items={items}
        renderItem={renderItem}
        sortValue={sortValue}
        sortOptions={[
          {
            label:
              'Last shrimpy shrimp created (ascending shrimp) shrimp shrimp shrimp shrimp shrimp',
            value: 'DATE_MODIFIED_DESC',
          },
          {label: 'Oldest update', value: 'DATE_MODIFIED_ASC'},
        ]}
        onSortChange={(selected) => {
          setSortValue(selected);
          console.log(`Sort option changed to ${selected}.`);
        }}
      />
    </Card>
  );

  function renderItem(item) {
    const {id, url, name, location} = item;
    const media = <Avatar customer size="medium" name={name} />;

    return (
      <ResourceItem
        id={id}
        url={url}
        media={media}
        accessibilityLabel={`View details for ${name}`}
      >
        <h3>
          <TextStyle variation="strong">{name}</TextStyle>
        </h3>
        <div>{location}</div>
      </ResourceItem>
    );
  }
}

🎩 checklist

  • Tested on mobile
  • Tested on multiple browsers
  • Tested for accessibility
  • Updated the component's README.md with documentation changes
  • Tophatted documentation changes in the style guide
  • For visual design changes, pinged one of @ HYPD, @ mirualves, @ sarahill, or @ ry5n to update the Polaris UI kit

@ghost
Copy link

ghost commented May 28, 2020

👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines.

@ghost ghost added the cla-needed Added by a bot. Contributor needs to sign the CLA Agreement. label May 28, 2020
@ghost ghost removed the cla-needed Added by a bot. Contributor needs to sign the CLA Agreement. label May 28, 2020
@alex-page alex-page force-pushed the master branch 2 times, most recently from 4eab9e5 to 9e09ba7 Compare January 15, 2021 05:17
Base automatically changed from master to main January 21, 2021 15:38
@alex-page alex-page force-pushed the main branch 7 times, most recently from 2c6e842 to d2611d6 Compare June 11, 2021 16:24
@amorriscode
Copy link
Author

@alex-page just wondering if there is interest in this PR or if I should close it?

Comment on lines +20 to +21
- Fixed incorrect `icon` color of `Button` when `destructive` and `plain` ([#2958](https://github.com/Shopify/polaris-react/issues/2958))
- Fixed sizing issue with `CheckableButtonWrapper` on `ResourceList` ([#2961](https://github.com/Shopify/polaris-react/issues/2961))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Fixed incorrect `icon` color of `Button` when `destructive` and `plain` ([#2958](https://github.com/Shopify/polaris-react/issues/2958))
- Fixed sizing issue with `CheckableButtonWrapper` on `ResourceList` ([#2961](https://github.com/Shopify/polaris-react/issues/2961))
- Fixed sizing issue with `CheckableButtonWrapper` on `ResourceList` ([#2961](https://github.com/Shopify/polaris-react/issues/2961))

Comment on lines +244 to +250
.HeaderTitleWrapper,
.CheckableButtonWrapper,
.AlternateToolWrapper,
.SortWrapper,
.SelectButtonWrapper {
@include layout-flex-fix;
}
Copy link
Member

@alex-page alex-page Jul 13, 2021

Choose a reason for hiding this comment

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

Are these values needed? I assume you added them so the areas to the right collapse down?

@kyledurand
Copy link
Member

If this is all in a flex container then I would imagine adding flex-shrink: 0 to CheckableButtonWrapper would have been all that's necessary for this fix. Is that something you tried?

@alex-page
Copy link
Member

@amorriscode I am going to close this PR but please reopen it if it is still an issue.

@alex-page alex-page closed this May 19, 2022
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.

[ResourceList] Improve styling of .HeaderContentWrapper children

3 participants