-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added aria-labels for the Movie action toolbar buttons
- Loading branch information
Erin Doyle
committed
Sep 2, 2018
1 parent
17b0ecc
commit 684ef97
Showing
5 changed files
with
38 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
|
||
const MovieToolbarButton = ({ movieTitle, buttonText, buttonLabel, clickHandler }) => { | ||
const ariaLabel = buttonLabel || `${buttonText} ${movieTitle}`; | ||
|
||
return ( | ||
<button className="btn btn-secondary" aria-label={ariaLabel} onClick={clickHandler}>{buttonText}</button> | ||
); | ||
}; | ||
|
||
MovieToolbarButton.defaultProps = { | ||
buttonText: '', | ||
buttonLabel: null, | ||
clickHandler: () => {} | ||
}; | ||
|
||
MovieToolbarButton.propTypes = { | ||
movieTitle: PropTypes.string.isRequired, | ||
buttonText: PropTypes.string, | ||
buttonLabel: PropTypes.string, | ||
clickHandler: PropTypes.func | ||
}; | ||
|
||
|
||
export default MovieToolbarButton; |
This file contains 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
This file contains 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