if no selected value, provide default value

main
briandennis 7 years ago committed by Brian Dennis
parent c50fc497b6
commit 5a11b115e0

@ -71,7 +71,7 @@ class Dropdown extends React.Component {
onClick={this.toggle} onClick={this.toggle}
> >
<div className={`dropdown-display ${this.state.isVisible ? 'is-visible' : ''}`}> <div className={`dropdown-display ${this.state.isVisible ? 'is-visible' : ''}`}>
<span>{this.props.selected.name}</span> <span>{this.props.selected ? this.props.selected.name : ''}</span>
<div className="arrow-down"> <div className="arrow-down">
<ArrowDown /> <ArrowDown />
</div> </div>

@ -48,7 +48,7 @@ export default class extends React.Component {
} }
render() { render() {
const selectedFont = FONTS.filter(font => font.id === this.props.selected)[0] const selectedFont = FONTS.filter(font => font.id === this.props.selected)[0] || {}
return ( return (
<div className="font-select-container"> <div className="font-select-container">
<div <div

Loading…
Cancel
Save