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

[ChoiceList] Add JSX support to the title prop #2355

Merged
merged 1 commit into from
Nov 1, 2019

Conversation

jtrollia
Copy link
Contributor

WHY are these changes introduced?

There are cases where a ChoiceList requires nested translations/HTML tags in its title.

Screen Shot 2019-10-24 at 11 38 24 AM

WHAT is this pull request doing?

Switching title's prop type from string to a more permissive ReactNode.

How to 🎩

yarn dev / playground

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

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

const choices = [
  {label: 'One', value: 'one'},
  {label: 'Two', value: 'two'},
  {label: 'Three', value: 'three'},
];

const JsxTitle = () => (
  <React.Fragment>
    JSX <b>title</b>
  </React.Fragment>
);

export function Playground() {
  return (
    <Page title="Playground">
      <ChoiceList title={<JsxTitle />} selected={[]} choices={choices} />,
    </Page>
  );
}

🎩 checklist

@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2019

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

No significant changes to src/**/*.tsx were detected.


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.

Copy link
Contributor

@LauraAubin LauraAubin 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
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.

Thanks @jtrollia! merge at your leisure

@jtrollia jtrollia force-pushed the jt/choicelist-update-title-prop-type branch from d2be642 to 71d7158 Compare October 31, 2019 17:33
UNRELEASED.md Outdated
@@ -10,6 +10,8 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f

### Enhancements

- Updated the type of the `title` prop in `ChoiceList` from `string` to `ReactNode` ([#2355](https://github.com/Shopify/polaris-react/pull/2355))

### Bug fixes

- Fixed an accessibility issue with `TextField` `multiline` where `aria-multiline` would be set to an invalid type `number` ([#2351](https://github.com/Shopify/polaris-react/pull/2351))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BPScott @LauraAubin I assume these have been re-introduced by the latest revert - should I removed them in this PR?

Copy link
Member

Choose a reason for hiding this comment

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

Unsure of the top of my head - rebase atop latest master and see what ends up being in this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I did :o

As you can see the latest version of the file, there are references to stuff that have been merged and shipped already - hence my confusion

From what I understand from the guidelines

The changelog is prepared manually immediately before a release, by moving changelog entries from UNRELEASED.md to CHANGELOG.md, under a new heading for the version number.

We have to clear the file manually?

Copy link
Contributor

Choose a reason for hiding this comment

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

Those entries must have not been cleared from the unreleased file with the latest release. Since they are referenced in the changelog, and I don't see a revert, I think it's fine to remove those entries from the unreleased doc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was referring to #2377, anyways I can clear the doc 👍

@jtrollia jtrollia force-pushed the jt/choicelist-update-title-prop-type branch from 71d7158 to de64cd1 Compare November 1, 2019 17:43
@jtrollia jtrollia merged commit abf386f into master Nov 1, 2019
@jtrollia jtrollia deleted the jt/choicelist-update-title-prop-type branch November 1, 2019 17:58
@PabloVallejo PabloVallejo temporarily deployed to production November 12, 2019 14:48 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.

4 participants