Skip to content

Add Feedback Modal#27

Open
wsm95 wants to merge 7 commits intomainfrom
will/feedback-modal
Open

Add Feedback Modal#27
wsm95 wants to merge 7 commits intomainfrom
will/feedback-modal

Conversation

@wsm95
Copy link
Collaborator

@wsm95 wsm95 commented Jan 11, 2022

Added the Feedback Modal component. I pretty much just copied the Feedback Modal from the current Badgers Report. Feel free to suggest changes. This is not included in the basic usage of the <Report /> component.

image

Button to display modal, rendered at the bottom left of the report.
image

*/

export const FeedbackModal = (props: FeedBackModalProps) => {
const { onFeedbackSubmit, displayStrings: passedInDisplayString } = props;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API is not consistent with the advanced usage that all components are supposed to support.
https://github.com/iTwin/itwin-synchronization-report-ui#4-advanced-usage

And the missing props (className and delegated props) would be difficult to add with the current setup: does it go on the button or the modal? Maybe it would help to split into separate components.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point. If we split this into separate components, how would that look in the .tsx? Something like

<FeedbackModalButton> 
    <FeedBackModal onFeedbackSubmit={() => void} />
</FeedbackModalButton>

or

<FeedbackModalButton modal={<FeedBackModal onFeedbackSubmit={() => void} />} /> 

Or maybe we change the name of this component to just <FeedbackModalButton /> and just expose the button and have the classnames apply to the button only. Another options would be to make the modal property on the second example above be optional, and if the user wants they can include a custom modal, but by default (nothing passed in) we display our modal.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense:

<FeedbackModalButton modal={<FeedBackModal onFeedbackSubmit={() => void} />} /> 

We can't make the modal optional because our modal doesn't do anything by default (the feedback goes nowhere).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duh, definitely can't be optional. I'll rename this component and split these apart. That will make it easier to test this in the future anyway.

Comment on lines +52 to +58
<InputGroup label='' message={displayStrings.inputGroupMessage} className='isr-feedback-inputgroup'>
<Radio name='choice' label='1' onChange={() => setRating(1)} />
<Radio name='choice' label='2' onChange={() => setRating(2)} />
<Radio name='choice' label='3' onChange={() => setRating(3)} />
<Radio name='choice' label='4' onChange={() => setRating(4)} />
<Radio name='choice' label='5' onChange={() => setRating(5)} />
</InputGroup>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to recommend this kind of layout.
image

Have you tried placing them inline?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried inline and didn't know what was worse tbh. I'm not a huge fan of either, but I guess we can take the one you like the best.

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a slider work? You can cap the slider at 5 and force the values to whole numbers.

@mayank99 mayank99 requested a review from Guillar1 as a code owner February 1, 2023 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants