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

Avoid recoloring any old icon inside Link #1729

Merged
merged 1 commit into from
Jun 28, 2019
Merged

Avoid recoloring any old icon inside Link #1729

merged 1 commit into from
Jun 28, 2019

Conversation

ry5n
Copy link
Contributor

@ry5n ry5n commented Jun 24, 2019

WHY are these changes introduced?

Fixes #1724

WHAT is this pull request doing?

The Link component is primarily intended for text links, but it can and is used for links around images and other content. Currently, all icons inside Link are set to the current text color, which doesn’t make sense except for text links

This problem was introduced in #1247 which adds an icon automatically for external links.

The fix is to scope the icon color change to the external link case only.

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import * as React from 'react';
import {ImageMajorMonotone} from '@shopify/polaris-icons';
import {Page, TextContainer, Link, Icon} from '../src';

interface State {}

export default class Playground extends React.Component<{}, State> {
  render() {
    return (
      <Page title="Playground">
        <TextContainer>
          <p>
            <Link url="#">
              <Icon source={ImageMajorMonotone} />
            </Link>
          </p>
          <p>
            <Link url="https://help.shopify.com/manual" external>
              Shopify Help Center
            </Link>
          </p>
        </TextContainer>
      </Page>
    );
  }
}

🎩 checklist

@BPScott BPScott temporarily deployed to polaris-react-pr-1729 June 24, 2019 22:25 Inactive
@ry5n ry5n changed the title [WIP] Avoid recoloring any old icon inside Link Avoid recoloring any old icon inside Link Jun 24, 2019
@ry5n ry5n requested review from carysmills and BPScott June 24, 2019 22:48
@ry5n ry5n force-pushed the fix-link-svg-color branch from ec75133 to 84a4a1b Compare June 24, 2019 22:52
@BPScott BPScott temporarily deployed to polaris-react-pr-1729 June 24, 2019 22:53 Inactive
Copy link
Member

@BPScott BPScott left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link

@carysmills carysmills left a comment

Choose a reason for hiding this comment

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

Code looks good to me!
Thanks for fixing this!

@ry5n ry5n force-pushed the fix-link-svg-color branch from 84a4a1b to 58c8a8a Compare June 26, 2019 02:06
@BPScott BPScott temporarily deployed to polaris-react-pr-1729 June 26, 2019 02:06 Inactive
@ry5n ry5n force-pushed the fix-link-svg-color branch from 58c8a8a to 15fa1be Compare June 27, 2019 00:36
@BPScott BPScott temporarily deployed to polaris-react-pr-1729 June 27, 2019 00:36 Inactive
@ry5n ry5n merged commit 22bb8e8 into master Jun 28, 2019
@ry5n ry5n deleted the fix-link-svg-color branch June 28, 2019 19:09
@dleroux dleroux temporarily deployed to production July 9, 2019 15:19 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.

Link modifies color of SVG child
4 participants