Commit 64bccb12 by Michael Roytman Committed by GitHub

Merge pull request #54 from edx/mroytman/button-label

change Button display prop to label
parents 335189a2 1766f0a2
{ {
"name": "@edx/paragon", "name": "@edx/paragon",
"version": "0.2.0", "version": "1.0.0",
"description": "Accessible, responsive UI component library based on Bootstrap.", "description": "Accessible, responsive UI component library based on Bootstrap.",
"main": "src/index.js", "main": "src/index.js",
"author": "arizzitano", "author": "arizzitano",
......
...@@ -10,8 +10,8 @@ Provides a button component that can be customized and handle multiple event han ...@@ -10,8 +10,8 @@ Provides a button component that can be customized and handle multiple event han
### `className` (string array; optional) ### `className` (string array; optional)
`className` specifies Bootstrap class names to apply to the button. See [Bootstrap's buttons documentation](https://getbootstrap.com/docs/4.0/components/buttons/) for a list of applicable class names. The default is an empty array. `className` specifies Bootstrap class names to apply to the button. See [Bootstrap's buttons documentation](https://getbootstrap.com/docs/4.0/components/buttons/) for a list of applicable class names. The default is an empty array.
### `display` (string; required) ### `label` (string; required)
`display` specifies the text that is displayed within the button. `label` specifies the text that is displayed within the button.
### `inputRef` (function; optional) ### `inputRef` (function; optional)
`inputRef` is a function that defines a reference for the button. An example `inputRef` from the calling component could look something like: `inputRef={(input) => { this.button = input; }}`. The default is an empty function. `inputRef` is a function that defines a reference for the button. An example `inputRef` from the calling component could look something like: `inputRef={(input) => { this.button = input; }}`. The default is an empty function.
......
...@@ -8,7 +8,7 @@ function Button(props) { ...@@ -8,7 +8,7 @@ function Button(props) {
const { const {
buttonType, buttonType,
className, className,
display, label,
inputRef, inputRef,
isClose, isClose,
onBlur, onBlur,
...@@ -35,7 +35,7 @@ function Button(props) { ...@@ -35,7 +35,7 @@ function Button(props) {
ref={inputRef} ref={inputRef}
{...other} {...other}
> >
{display} {label}
</button> </button>
); );
} }
...@@ -43,7 +43,7 @@ function Button(props) { ...@@ -43,7 +43,7 @@ function Button(props) {
export const buttonPropTypes = { export const buttonPropTypes = {
buttonType: PropTypes.string, buttonType: PropTypes.string,
className: PropTypes.arrayOf(PropTypes.string), className: PropTypes.arrayOf(PropTypes.string),
display: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired, label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
inputRef: PropTypes.func, inputRef: PropTypes.func,
isClose: PropTypes.bool, isClose: PropTypes.bool,
onBlur: PropTypes.func, onBlur: PropTypes.func,
......
...@@ -127,7 +127,7 @@ class Dropdown extends React.Component { ...@@ -127,7 +127,7 @@ class Dropdown extends React.Component {
aria-expanded={this.state.open} aria-expanded={this.state.open}
aria-haspopup="true" aria-haspopup="true"
buttonType={this.props.buttonType} buttonType={this.props.buttonType}
display={this.props.title} label={this.props.title}
onClick={this.toggle} onClick={this.toggle}
onKeyDown={this.handleToggleKeyDown} onKeyDown={this.handleToggleKeyDown}
className={[ className={[
......
...@@ -37,7 +37,7 @@ class ModalWrapper extends React.Component { ...@@ -37,7 +37,7 @@ class ModalWrapper extends React.Component {
/> />
<Button <Button
onClick={this.openModal} onClick={this.openModal}
display="Click me to open a modal!" label="Click me to open a modal!"
buttonType="light" buttonType="light"
inputRef={(input) => { this.button = input; }} inputRef={(input) => { this.button = input; }}
/> />
...@@ -71,15 +71,15 @@ storiesOf('Modal', module) ...@@ -71,15 +71,15 @@ storiesOf('Modal', module)
body="Modal body." body="Modal body."
buttons={[ buttons={[
<Button <Button
display="Blue button!" label="Blue button!"
buttonType="primary" buttonType="primary"
/>, />,
{ {
display: 'Red button!', label: 'Red button!',
buttonType: 'danger', buttonType: 'danger',
}, },
<Button <Button
display="Green button!" label="Green button!"
buttonType="success" buttonType="success"
/>, />,
]} ]}
...@@ -93,7 +93,7 @@ storiesOf('Modal', module) ...@@ -93,7 +93,7 @@ storiesOf('Modal', module)
body="Custom body!" body="Custom body!"
buttons={[ buttons={[
<Button <Button
display="Dark button!" label="Dark button!"
buttonType="dark" buttonType="dark"
/>, />,
]} ]}
...@@ -107,7 +107,7 @@ storiesOf('Modal', module) ...@@ -107,7 +107,7 @@ storiesOf('Modal', module)
body="Modal body." body="Modal body."
buttons={[ buttons={[
<Button <Button
display="Click me and check the console!" label="Click me and check the console!"
buttonType="light" buttonType="light"
onClick={action('button-click')} onClick={action('button-click')}
/>, />,
...@@ -142,7 +142,7 @@ storiesOf('Modal', module) ...@@ -142,7 +142,7 @@ storiesOf('Modal', module)
label="E-Mail Address" label="E-Mail Address"
/> />
<Button <Button
display="Get my facts!" label="Get my facts!"
/> />
</div> </div>
)} )}
......
...@@ -24,15 +24,15 @@ describe('<Modal />', () => { ...@@ -24,15 +24,15 @@ describe('<Modal />', () => {
describe('correct rendering', () => { describe('correct rendering', () => {
const buttons = [ const buttons = [
<Button <Button
display="Blue button!" label="Blue button!"
buttonType="primary" buttonType="primary"
/>, />,
{ {
display: 'Red button!', label: 'Red button!',
buttonType: 'danger', buttonType: 'danger',
}, },
<Button <Button
display="Green button!" label="Green button!"
buttonType="success" buttonType="success"
/>, />,
]; ];
......
...@@ -96,7 +96,7 @@ class Modal extends React.Component { ...@@ -96,7 +96,7 @@ class Modal extends React.Component {
<div className={styles['modal-header']}> <div className={styles['modal-header']}>
<h5 className={styles['modal-title']} id={this.headerId}>{this.props.title}</h5> <h5 className={styles['modal-title']} id={this.headerId}>{this.props.title}</h5>
<Button <Button
display={<span aria-hidden="true">&times;</span>} label={<span aria-hidden="true">&times;</span>}
aria-label={this.props.closeText} aria-label={this.props.closeText}
buttonType="light" buttonType="light"
onClick={this.close} onClick={this.close}
...@@ -110,7 +110,7 @@ class Modal extends React.Component { ...@@ -110,7 +110,7 @@ class Modal extends React.Component {
<div className={styles['modal-footer']}> <div className={styles['modal-footer']}>
{this.renderButtons()} {this.renderButtons()}
<Button <Button
display={this.props.closeText} label={this.props.closeText}
buttonType="secondary" buttonType="secondary"
onClick={this.close} onClick={this.close}
inputRef={(input) => { this.closeButton = input; }} inputRef={(input) => { this.closeButton = input; }}
......
...@@ -37,7 +37,7 @@ class StatusAlertWrapper extends React.Component { ...@@ -37,7 +37,7 @@ class StatusAlertWrapper extends React.Component {
/> />
<Button <Button
onClick={this.openStatusAlert} onClick={this.openStatusAlert}
display="Click me to open a Status Alert!" label="Click me to open a Status Alert!"
buttonType="light" buttonType="light"
inputRef={(input) => { this.button = input; }} inputRef={(input) => { this.button = input; }}
/> />
......
...@@ -68,7 +68,7 @@ class StatusAlert extends React.Component { ...@@ -68,7 +68,7 @@ class StatusAlert extends React.Component {
inputRef={(input) => { this.xButton = input; }} inputRef={(input) => { this.xButton = input; }}
onClick={this.close} onClick={this.close}
onKeyDown={this.handleKeyDown} onKeyDown={this.handleKeyDown}
display={<span aria-hidden="true">&times;</span>} label={<span aria-hidden="true">&times;</span>}
isClose isClose
/> />
) : null; ) : null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment