FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore(Switch): convert Switch to TypeScript by tlabaj · Pull Request #2311 · patternfly/patternfly-react · GitHub

chore(Switch): convert Switch to TypeScript - #2311

Merged
redallen merged 4 commits into
patternfly:masterfrom
tlabaj:switch
Jul 2, 2019
Merged

chore(Switch): convert Switch to TypeScript#2311
redallen merged 4 commits into
patternfly:masterfrom
tlabaj:switch

Conversation

tlabaj commented Jun 20, 2019

Copy link
Copy Markdown
Contributor

#2019

What:

Additional issues:

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-2311.surge.sh

isDisabled?: boolean,
/** A callback for when the Switch selection changes. (isChecked, event) => {} */
onChange: PropTypes.func,
onChange?(checked: boolean, event: FormEvent<HTMLInputElement>): void;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Use an arrow function so the docs pick this up properly. Like `onChange?: (checked: boolean, event: FormEvent) => void;

'aria-label': ''
};
export class Switch extends React.Component<SwitchProps> {
id = '';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Remove this class attribute

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Not sure what the purpose of this id is ... is it suppose to be the same as props.id?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

it instantiates the id when it is generated. And there is no id prop set.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Shouldn't it instantiate it as a defaultProp to getUniqueId()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I am not sure. Does it work differently in TS than JS. In JS if you set defaultProp to getUniqueId, if you had more hat one Switch on the page the id's would all be the same? That is why we had it in the constructor before.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks like it will set it for all of the name to be the same based off the time. Leave it in the constructor.

dlabaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Wondering what was the use case for that separate class attribute ID.

'aria-label': ''
};
export class Switch extends React.Component<SwitchProps> {
id = '';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Not sure what the purpose of this id is ... is it suppose to be the same as props.id?

'aria-label': ''
};
export class Switch extends React.Component<SwitchProps> {
id = '';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks like it will set it for all of the name to be the same based off the time. Leave it in the constructor.

redallen merged commit dac87ba into patternfly:master Jul 2, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

5 participants


Back | FazBrowse Home | New Git URL