-
Notifications
You must be signed in to change notification settings - Fork 72
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
Various small code fixes / type fixes #3313
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,7 +145,7 @@ You can use `Dropdown.Toggle` with [IconButton](/components/iconbutton) componen | |
```jsx live | ||
<Dropdown.Deprecated> | ||
<Dropdown.Deprecated.Button> | ||
<Icon className="fa fa-user pr-3" alt="" /> | ||
<Icon className="fa fa-user pr-3" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! |
||
Search Engines | ||
</Dropdown.Deprecated.Button> | ||
<Dropdown.Deprecated.Menu> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,9 @@ or [select attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element | |
() => { | ||
{/* start example state */} | ||
const [type, setType] = useState('default'); | ||
const [value, setValue] = useState(''); | ||
{/* end example state */} | ||
const handleChange = (e) => setValue(e.target.value); | ||
|
||
const inputs = { | ||
default: ( | ||
|
@@ -144,8 +146,6 @@ or [select attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element | |
</Form.Group> | ||
</>), | ||
}; | ||
const [value, setValue] = useState(''); | ||
const handleChange = (e) => setValue(e.target.value); | ||
return ( | ||
<> | ||
{/* start example form block */} | ||
|
@@ -172,7 +172,9 @@ See [react-imask](https://imask.js.org) for documentation on available props. | |
() => { | ||
{/* start example state */} | ||
const [maskType, setMaskType] = useState('phone'); | ||
const [value, setValue] = useState(''); | ||
{/* end example state */} | ||
const handleChange = (e) => setValue(e.target.value); | ||
|
||
const inputsWithMask = { | ||
phone: ( | ||
|
@@ -255,10 +257,6 @@ See [react-imask](https://imask.js.org) for documentation on available props. | |
), | ||
}; | ||
|
||
const [value, setValue] = useState(''); | ||
|
||
const handleChange = (e) => setValue(e.target.value); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes: |
||
return ( | ||
<> | ||
{/* start example form block */} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ interface Props extends React.HTMLAttributes<HTMLButtonElement> { | |
variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand'; | ||
/** size of button to render */ | ||
size?: 'sm' | 'md' | 'inline'; | ||
/** Used with `IconButtonToggle` */ | ||
value?: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you can see in the docs, Fixed a type error:
|
||
/** no children */ | ||
children?: never; | ||
} | ||
|
@@ -104,6 +106,7 @@ IconButton.defaultProps = { | |
size: 'md', | ||
onClick: () => {}, | ||
isActive: false, | ||
value: undefined, | ||
children: undefined, | ||
}; | ||
|
||
|
@@ -140,6 +143,8 @@ IconButton.propTypes = { | |
size: PropTypes.oneOf(['sm', 'md', 'inline']), | ||
/** whether to show the `IconButton` in an active state, whose styling is distinct from default state */ | ||
isActive: PropTypes.bool, | ||
/** Used with <IconButtonToggle> */ | ||
value: PropTypes.string, | ||
}; | ||
|
||
interface PropsWithTooltip extends Props { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,14 +90,13 @@ notes: | | |
label="Favorite Color" | ||
options={['', 'red', 'orange', 'yellow', 'green', 'blue', 'purple']} | ||
validator={value => { | ||
let feedback = { isValid: true }; | ||
if (!value) { | ||
feedback = { | ||
return { | ||
isValid: false, | ||
validationMessage: 'Please make a selection.', | ||
}; | ||
} | ||
return feedback; | ||
return { isValid: true }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change (A) simplifies the validator function, making it a bit more clear, and (B) helps TypeScript avoid a type inference mistake: |
||
}} | ||
/> | ||
``` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,7 +105,7 @@ class ListBoxWrapperForOnSelect extends React.Component { | |
<span className="sr-only">none</span> | ||
) : ( | ||
<span | ||
arialabelledby={`list-box-option-${ | ||
aria-labelledby={`list-box-option-${ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
this.state.selectedOptionIndex | ||
}`} | ||
> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ The standard `ModalDialog` composition. `StandardModal` passes all of its props | |
footerNode={( | ||
<ActionRow> | ||
<p className="small"> | ||
<Hyperlink href="#">Get help</Hyperlink> | ||
<Hyperlink destination="#">Get help</Hyperlink> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although this was working, the |
||
</p> | ||
<ActionRow.Spacer /> | ||
<Button variant="tertiary" onClick={close}>Cancel</Button> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ export const isEveryPropDefined = (props, otherPropNames) => otherPropNames | |
* Returns a PropType entry with the given propType that is required if otherPropName | ||
* is truthy. | ||
* @param {func} propType - target PropType | ||
* @param {string} otherPropName - string name for prop that, if true, marks the | ||
* @param {string | string[]} otherPropName - string name for prop that, if true, marks the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you can see in the implementation below as well as how this function is used, this param accepts a string array. |
||
* associated prop as required | ||
* @return {func} - PropType based on propType that is required if otherPropName is | ||
* set to true. | ||
|
bradenmacdonald marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
rest
parameter was unused.Fixes:
'rest' is declared but its value is never read.