-
Notifications
You must be signed in to change notification settings - Fork 22
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
refactor ButtonWIthIcon to replace ButtonSearch #81
Changes from all commits
a3f6c79
bbe3910
a45ecc9
b01be9a
7920105
bd51dfb
cae56c0
f26f142
e637d20
fec3fbc
58be836
8c95fc0
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
___DESCRIPTION___ | ||
change | ||
minor | ||
- (React) Refactored ButtonWithIcon to replace ButtonSearch component #81 |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
### Description | ||
A button that displays with an icon component. | ||
e.g. ButtonSearch, which is used for submitting a keyword search. | ||
e.g. Button with chevron, which is used for toggling between the expanded state and the collapsed state. | ||
|
||
### Changes for React | ||
* Button with Icon is a common button pattern that is currently not available in Patternlab. It's an extension on top of the [Button Search atom](https://mayflower.digital.mass.gov/?p=atoms-button-search). | ||
* `classes` array: To improve reusability of this component, classes can now be added to the button by adding them to the new `classes` array. | ||
* `ariaLabel` string: To improve accessibility of this component, an aria-label can be added if the displayed text is not helpful to assistive technologies. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import ButtonSearch from '../../atoms/buttons/ButtonSearch'; | ||
import ButtonWithIcon from '../../atoms/buttons/ButtonWithIcon'; | ||
import TypeAheadDropdown from '../../molecules/TypeAheadDropdown'; | ||
import './HeaderSearch.css'; | ||
|
||
|
@@ -46,7 +46,7 @@ class HeaderSearch extends React.Component { | |
type="search" | ||
value={this.state.value} | ||
/> | ||
<ButtonSearch {...headerSearch.buttonSearch} /> | ||
<ButtonWithIcon {...headerSearch.buttonSearch} /> | ||
</form> | ||
</section> | ||
</div> | ||
|
@@ -62,7 +62,7 @@ HeaderSearch.propTypes = { | |
/** The placeholder text for the input */ | ||
placeholder: PropTypes.string, | ||
/** The Search button */ | ||
buttonSearch: PropTypes.shape(ButtonSearch.propTypes), | ||
buttonSearch: PropTypes.shape(ButtonWithIcon.propTypes), | ||
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 prop is no longer being used in render. I don't believe that's intentional? 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. buttonSearch is accessed on line 49 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. I forgot to add the props before... |
||
/** Custom submit function */ | ||
onSubmit: PropTypes.func, | ||
/** Custom change function for the text input */ | ||
|
@@ -78,7 +78,7 @@ HeaderSearch.defaultProps = { | |
label: 'Search terms', | ||
placeholder: 'Search Mass.gov', | ||
buttonSearch: { | ||
ariaLabel: 'Search' | ||
ariaLabel: 'search' | ||
} | ||
}; | ||
|
||
|
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.
do you want all these available as knobs for buttonsearch - i would assume search icon etc should not be an option to play with in knobs cause this is a specific variant that needs that icon type