mirror of
https://github.com/scratchfoundation/scratchjr-website.git
synced 2025-06-27 15:30:20 -04:00
Wholesale changes due to formatting, lint etc. Substantive changes to sectionitem.jsx component. Realized that it would be more reactified with child components instead of ‘description’ prop. I didn’t completely get rid of description prop, but made it optional. Should probably go back and change all the uses, but only did the ones with long lines and other lint issues.
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import classNames from 'classnames';
|
|
import './guidebutton.scss';
|
|
|
|
export default class GuideButton extends React.Component {
|
|
constructor (props) {
|
|
super(props);
|
|
this.handleClick = this.handleClick.bind(this);
|
|
}
|
|
handleClick () {
|
|
this.props.clickHandler(this.props.index);
|
|
}
|
|
render () {
|
|
var classes = classNames({
|
|
'guide-button': true,
|
|
'guide-button-selected': this.props.selected
|
|
});
|
|
return (
|
|
<div>
|
|
<div className={classes} id={this.props.name} onClick={this.handleClick}>
|
|
<div className="guide-button-text">{this.props.index + 1}</div>
|
|
</div>
|
|
{this.props.children}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
GuideButton.propTypes = {
|
|
name: React.PropTypes.string.isRequired,
|
|
index: React.PropTypes.number.isRequired,
|
|
clickHandler: React.PropTypes.func.isRequired,
|
|
lines: React.PropTypes.array,
|
|
selected: React.PropTypes.bool,
|
|
children: React.PropTypes.node
|
|
};
|
|
GuideButton.defaultProps = {selected: false};
|