From 8fff3fcf59a28c752b17cf742c742e88deb1d5dd Mon Sep 17 00:00:00 2001 From: John Knox Date: Fri, 6 Sep 2019 08:31:18 -0700 Subject: [PATCH] Apply some styles Summary: It looks a lot better now, but the input is only single line, so entering more than one line would not be good right now. Reviewed By: danielbuechele Differential Revision: D17210091 fbshipit-source-id: 9313b6a67731cfa944394962cdc09be915a07720 --- src/chrome/RatingButton.tsx | 116 +++++++++++++++++++++++------------- src/utils/icons.js | 4 +- 2 files changed, 77 insertions(+), 43 deletions(-) diff --git a/src/chrome/RatingButton.tsx b/src/chrome/RatingButton.tsx index 174652a7e..519b13719 100644 --- a/src/chrome/RatingButton.tsx +++ b/src/chrome/RatingButton.tsx @@ -6,7 +6,16 @@ */ import React, {Component, ReactElement} from 'react'; -import {Glyph, Popover, FlexColumn, FlexRow, Button, Checkbox} from 'flipper'; +import { + Glyph, + Popover, + FlexColumn, + FlexRow, + Button, + Checkbox, + styled, + Input, +} from 'flipper'; import GK from '../fb-stubs/GK'; import * as UserFeedback from '../fb-stubs/UserFeedback'; import {FeedbackPrompt} from '../fb-stubs/UserFeedback'; @@ -36,6 +45,14 @@ class PredefinedComment extends Component<{ } } +const Row = styled(FlexRow)({ + marginTop: 5, + marginBottom: 5, + justifyContent: 'center', + textAlign: 'center', + color: '#9a9a9a', +}); + class FeedbackComponent extends Component< { submitRating: (rating: number) => void; @@ -54,6 +71,7 @@ class FeedbackComponent extends Component< allowUserInfoSharing: boolean; nextAction: NextAction; predefinedComments: {[key: string]: boolean}; + comment: string; } > { state = { @@ -65,6 +83,7 @@ class FeedbackComponent extends Component< (acc, cv) => ({...acc, [cv]: false}), {}, ), + comment: '', }; onSubmitRating(newRating: number) { const nextAction = newRating <= 2 ? 'leave-comment' : 'finished'; @@ -116,15 +135,15 @@ class FeedbackComponent extends Component< this.onSubmitRating(index + 1); }}> )); @@ -132,8 +151,8 @@ class FeedbackComponent extends Component< switch (this.state.nextAction) { case 'select-rating': body = [ - {this.props.promptData.bodyText}, - {stars}, + {this.props.promptData.bodyText}, + {stars}, ]; break; case 'leave-comment': @@ -154,18 +173,27 @@ class FeedbackComponent extends Component< /> )); body = [ - {predefinedComments}, - {this.props.promptData.commentPlaceholder}, - + {predefinedComments}, + + this.setState({comment: e.target.value})} + /> + , + {'Tool owner can contact me '} - - , + , ]; break; case 'finished': @@ -177,12 +205,19 @@ class FeedbackComponent extends Component< } } return ( - - + + {this.state.nextAction === 'finished' ? this.props.promptData.postSubmitHeading : this.props.promptData.preSubmitHeading} - + {body} ); @@ -232,32 +267,31 @@ export default class RatingButton extends Component { if (!promptData) { return null; } - const stars = ( -
- + return ( +
+
+ +
+ {this.state.isShown ? ( + {}} + children={ + { + this.setState({isShown: false}); + }} + promptData={promptData} + /> + } + /> + ) : null}
); - return [ - stars, - this.state.isShown ? ( - {}} - children={ - { - this.setState({isShown: false}); - }} - promptData={promptData} - /> - } - /> - ) : null, - ]; } } diff --git a/src/utils/icons.js b/src/utils/icons.js index 34f98763f..e35054bad 100644 --- a/src/utils/icons.js +++ b/src/utils/icons.js @@ -34,8 +34,8 @@ module.exports = { 'triangle-right': [12], 'chevron-right': [8], 'chevron-down': [8], - star: [16], - 'star-outline': [16], + star: [16, 24], + 'star-outline': [16, 24], }, // $FlowFixMe: not using flow in this file