polaris icon indicating copy to clipboard operation
polaris copied to clipboard

Add small icon size for Cancel icon

Open loic-d opened this issue 8 years ago • 3 comments

Feature request summary

Consider adding another size for the cancel icon.

Rationale

In Discounts, we have the following UI allowing merchants to add products or collections to their discount. Once added, products or collections can also be removed using the X icon.

screen shot 2018-10-26 at 1 29 12 pm

Originally, we came up with our own HTML button wrapping the Icon component. We added some CSS to force the Icon size.

<button
        type="button"
        className={styles.RemoveButton}
        onClick={this.handleRemoveItem}
        onTouchStart={this.handleRemoveItem}
      >
        <Icon source="cancel" color="skyDark" />
</button>

.RemoveButton {
  @include unstyled-button;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: spacing(extra-tight);
}

To improve accessibility, we switched to the Polaris Button with an icon. But the icon size is too big, even when using cancelSmall.

<div className={styles.RemoveButton}>
        <Button
          id={`remove-btn-${id}`}
          icon="cancelSmall"
          plain
          onClick={this.handleRemoveItem}
        />
</div>

We've decided to keep the Polaris Button and added some CSS to force the size/position of the icon:

.RemoveButton {
  display: flex;

  svg {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    width: 1.5rem;
    height: 1.5rem;
    margin: auto;
    transform: translateY(-50%);
    text-align: center;
    color: color('sky', 'dark');
  }
}

Another solution would be to just add another icon size.

screen shot 2018-10-26 at 1 52 36 pm

🌟 Feature requests that are not yet planned will be closed. We then use the issue’s :+1: upvotes to track and set priorities. See the contribution guidelines for more information.

loic-d avatar Oct 26 '18 17:10 loic-d

👋 Thanks for opening your first issue. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. You can also join #polaris on the Shopify Partners Slack.

ghost avatar Oct 26 '18 17:10 ghost

But the icon size is too big, even when using cancelSmall.

Can you attach a screenshot? The small cancel icon is meant for this use case.

ry5n avatar Oct 26 '18 18:10 ry5n

As discussed in Slack, it seems like the right thing to do is to use cancelSmall. Closing this issue for now.

loic-d avatar Oct 26 '18 19:10 loic-d