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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextField] Remove deprecated lifecycle method #629

Merged
merged 2 commits into from Nov 21, 2018
Merged

Conversation

AndrewMusgrave
Copy link
Member

WHY are these changes introduced?

Part of #519

WHAT is this pull request doing?

  • Replaces lifecycle method
  • Add test

How to 馃帺

Add a console.log to textfield render to check it's current id during render. Check the console, onChange will trigger the id switch.

Copy-paste this code in playground/Playground.tsx:
import * as React from 'react';
import {TextField} from '@shopify/polaris';

interface State {
  id: string | undefined;
}

export default class TextFieldExample extends React.Component {
  state = {
    id: undefined,
  };

  handleChange = () => {
    this.setState(({id}) => ({
      id: id
        ? undefined
        : Math.random()
            .toString(36)
            .substring(7),
    }));
  };

  render() {
    const {id} = this.state;
    const props = {
      label: 'Store name',
      value: '',
      onChange: this.handleChange,
      id,
    };
    console.log(`Current id: ${id}`);
    return <TextField {...props} />;
  }
}

@BPScott BPScott temporarily deployed to polaris-react-pr-629 November 15, 2018 22:20 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-629 November 15, 2018 22:22 Inactive
UNRELEASED.md Outdated
@@ -6,6 +6,8 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f

### Enhancements

-`TextField` no longer uses `componentWillReceiveProps` ([#628](https://github.com/Shopify/polaris-react/pull/628))

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

Copy link
Member Author

Choose a reason for hiding this comment

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

Prettier added this line, let me restart vscode code to check if it was an oddity.

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems prettier wants this line

Copy link
Contributor

@tmlayton tmlayton left a comment

Choose a reason for hiding this comment

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

Looks good. Is it worth adding a test for the prevState.id code path, too?

@BPScott BPScott temporarily deployed to polaris-react-pr-629 November 16, 2018 15:38 Inactive
Copy link
Contributor

@dleroux dleroux left a comment

Choose a reason for hiding this comment

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

馃帺 馃憤 :shipit: after the conflict on unreleased of course :)

@AndrewMusgrave AndrewMusgrave merged commit 484aabe into master Nov 21, 2018
@AndrewMusgrave AndrewMusgrave deleted the dep-lc-tf branch November 21, 2018 15:14
@danrosenthal danrosenthal temporarily deployed to production December 4, 2018 19:16 Inactive
MindRave added a commit that referenced this pull request Mar 7, 2023
### WHY are these changes introduced?

Fixes [#629](Shopify/storefront-setup#629)

The Icon component doesn't have the "Magic" colour yet, whereas the
tokens are already available for use. We should add "magic" to the
colour prop and the CSS.

### WHAT is this pull request doing?

<img src="https://shopify.click/03-54-46fx7-wqvbe.png" width="300" />

- Added `magic` entry to the Icon color prop type.
- Added corresponding CSS rule.
- Added Storybook variant.

### 馃帺 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
N/A
- [x] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
N/A
- [ ] Updated the component's `README.md` with documentation changes N/A
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide N/A
juzser pushed a commit to juzser/polaris that referenced this pull request Jul 27, 2023
### WHY are these changes introduced?

Fixes [Shopify#629](https://github.com/Shopify/storefront-setup/issues/629)

The Icon component doesn't have the "Magic" colour yet, whereas the
tokens are already available for use. We should add "magic" to the
colour prop and the CSS.

### WHAT is this pull request doing?

<img src="https://shopify.click/03-54-46fx7-wqvbe.png" width="300" />

- Added `magic` entry to the Icon color prop type.
- Added corresponding CSS rule.
- Added Storybook variant.

### 馃帺 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
N/A
- [x] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
N/A
- [ ] Updated the component's `README.md` with documentation changes N/A
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide N/A
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

6 participants