Simplified to function component

This commit is contained in:
Rainer Simon 2020-12-20 16:29:20 +01:00
parent 4e712cadbf
commit f186ff8109
1 changed files with 34 additions and 17 deletions

View File

@ -1,11 +1,26 @@
import React, { Component } from 'preact/compat';
import React from 'preact/compat';
import Select from 'react-select';
export const purposes = [{'value': 'assessing', 'label': 'Assessing'}, {'value': 'bookmarking', 'label': 'Bookmarking'}, {'value': 'classifying', 'label': 'Classifying'}, {'value': 'commenting', 'label': 'Commenting'}, {'value': 'describing', 'label': 'Describing'},{'value': 'editing', 'label': 'Editing'}, {'value': 'highlighting', 'label': 'Highlighting'},{'value': 'identifying', 'label': 'Identifying'},{'value': 'linking', 'label': 'Linking'},{'value': 'moderating', 'label': 'Moderating'},{'value': 'questioning', 'label': 'Questioning'},{'value': 'replying', 'label': 'Replying'}]
export const purposes = [
{'value': 'assessing', 'label': 'Assessing'},
{'value': 'bookmarking', 'label': 'Bookmarking'},
{'value': 'classifying', 'label': 'Classifying'},
{'value': 'commenting', 'label': 'Commenting'},
{'value': 'describing', 'label': 'Describing'},
{'value': 'editing', 'label': 'Editing'},
{'value': 'highlighting', 'label': 'Highlighting'},
{'value': 'identifying', 'label': 'Identifying'},
{'value': 'linking', 'label': 'Linking'},
{'value': 'moderating', 'label': 'Moderating'},
{'value': 'questioning', 'label': 'Questioning'},
{'value': 'replying', 'label': 'Replying'}
]
const PurposeDropdown = props => {
const selectedOption = this.props.content ?
{ 'value': this.props.content, 'label': this.props.content.charAt(0).toUpperCase() + this.props.content.slice(1) } : undefined;
export default class PurposeDropdown extends Component {
render() {
const selectedOption = this.props.content ? {'value': this.props.content, 'label': this.props.content.charAt(0).toUpperCase() + this.props.content.slice(1) } : undefined;
return (
<div class="r6o-purposedropdown">
<Select
@ -16,5 +31,7 @@ export default class PurposeDropdown extends Component {
/>
</div>
);
}
}
export default PurposeDropdown;