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}
>
<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">
<ArrowDown />
</div>

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

Loading…
Cancel
Save