update dropdown widget

This commit is contained in:
Niqui O'Neill 2020-11-30 14:26:25 -08:00
parent e1276a60e1
commit 751946a5eb
4 changed files with 11 additions and 6 deletions

View File

@ -3,7 +3,7 @@ import { useState } from 'preact/hooks';
import TimeAgo from 'timeago-react'; import TimeAgo from 'timeago-react';
import DropdownMenu from './DropdownMenu'; import DropdownMenu from './DropdownMenu';
import TextEntryField from './TextEntryField'; import TextEntryField from './TextEntryField';
import TypeDropdown from './TypeDropdown'; import PurposeDropdown from './PurposeDropdown';
import { ChevronDownIcon } from '../../../Icons'; import { ChevronDownIcon } from '../../../Icons';
import i18n from '../../../i18n'; import i18n from '../../../i18n';
@ -58,7 +58,7 @@ const Comment = props => {
/> />
{ creatorInfo } { creatorInfo }
{ props.purpose == true && { props.purpose == true &&
<TypeDropdown <PurposeDropdown
editable={isEditable} editable={isEditable}
content={props.body.purpose} content={props.body.purpose}
onChange={onUpdateDropdown} onChange={onUpdateDropdown}

View File

@ -2,7 +2,7 @@ import React from 'preact/compat';
import Comment from './Comment'; import Comment from './Comment';
import TextEntryField from './TextEntryField'; import TextEntryField from './TextEntryField';
import i18n from '../../../i18n'; import i18n from '../../../i18n';
import TypeDropdown from './TypeDropdown'; import PurposeDropdown from './PurposeDropdown';
const purposes = ['assessing', 'bookmarking', 'classifying', 'commenting', 'describing', 'editing', 'highlighting', 'identifying', 'linking', 'moderating', 'questioning'] const purposes = ['assessing', 'bookmarking', 'classifying', 'commenting', 'describing', 'editing', 'highlighting', 'identifying', 'linking', 'moderating', 'questioning']
/** /**
@ -108,7 +108,7 @@ const CommentWidget = props => {
onSaveAndClose={() => props.onSaveAndClose()} onSaveAndClose={() => props.onSaveAndClose()}
/> />
{ props.purpose == true && draftReply.value.length > 0 && { props.purpose == true && draftReply.value.length > 0 &&
<TypeDropdown <PurposeDropdown
editable={true} editable={true}
content={draftReply.purpose} content={draftReply.purpose}
onChange={onUpdatePurpose} onChange={onUpdatePurpose}

View File

@ -4,11 +4,11 @@ import Select from 'react-select';
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'}] 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'}]
export default class TypeDropdown extends Component { export default class PurposeDropdown extends Component {
render() { render() {
const selectedOption = this.props.content ? {'value': this.props.content, 'label': this.props.content.charAt(0).toUpperCase() + this.props.content.slice(1) } : undefined; const selectedOption = this.props.content ? {'value': this.props.content, 'label': this.props.content.charAt(0).toUpperCase() + this.props.content.slice(1) } : undefined;
return ( return (
<div class="purposedropdown"> <div class="r6o-purposedropdown">
<Select <Select
value={selectedOption} value={selectedOption}
onChange={this.props.onChange} onChange={this.props.onChange}

View File

@ -88,3 +88,8 @@
} }
} }
.r6o-purposedropdown {
width: 150px;
display: inline-block;
}