[SharedUX] Add feedback snippet to SharedUX storybook#235197
[SharedUX] Add feedback snippet to SharedUX storybook#235197angeles-mb merged 3 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/appex-sharedux (Team:SharedUX) |
|
|
||
| export const Confetti = () => ( | ||
| <Suspense fallback={null}> | ||
| <LazyConfetti /> |
There was a problem hiding this comment.
Had to wrap Confetti component in Suspense to avoid this error which happened both in Storybook and when testing the component in other parts of Kibana Error: A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.
By doing this, FeedbackSnippet consumers don't have to worry about its lazy loading.
There was a problem hiding this comment.
nit: you can also use dynamic
import { dynamic } from '@kbn/shared-ux-utility';
export const Confetti = dynamic(() => import('./confetti'));Confetti also doesn't require a default export. You can remove the eslint disable and default export and use dynamic for that, too:
import { dynamic } from '@kbn/shared-ux-utility';
export const Confetti = dynamic(() => import('./confetti').then(
mod => ({default: mod.Confetti})
);There was a problem hiding this comment.
I didn't know about that dynamic utility, thanks for sharing! Addressed!
Dosant
left a comment
There was a problem hiding this comment.
lgtm,
have a suggestion to consider
| feedbackSnippetId={feedbackSnippetId} | ||
| promptViewMessage={promptViewMessage} | ||
| surveyUrl={feedbackSurveyUrl} | ||
| showFeedbackButtonTopDivider={true} |
There was a problem hiding this comment.
This feels very specific. Maybe this should just be a CSS override or addition instead.
<FeedbackSnippet
css={`top-divider-css-goes-here`}
feedbackButtonMessage={feedbackButtonMessage}
feedbackSnippetId={feedbackSnippetId}
promptViewMessage={promptViewMessage}
surveyUrl={feedbackSurveyUrl}
There was a problem hiding this comment.
Another option would be to encapsulate this change with some more expressive prop, like type or contained. For example, if we want to include a top divider when the FeedbackSnippet is contained within a panel, you can use "contained", or similar.
In other words, add a more expressive prop. From this, I don't know why I would or would not set this prop.
There was a problem hiding this comment.
I agree it is too specific, I went with the css + className approach for the NavigationFeedbackSnippet to be able to use custom styling (only for the Button, not the Panel).
clintandrewhall
left a comment
There was a problem hiding this comment.
Great job! Please address these nits before committing.
|
|
||
| export const Confetti = () => ( | ||
| <Suspense fallback={null}> | ||
| <LazyConfetti /> |
There was a problem hiding this comment.
nit: you can also use dynamic
import { dynamic } from '@kbn/shared-ux-utility';
export const Confetti = dynamic(() => import('./confetti'));Confetti also doesn't require a default export. You can remove the eslint disable and default export and use dynamic for that, too:
import { dynamic } from '@kbn/shared-ux-utility';
export const Confetti = dynamic(() => import('./confetti').then(
mod => ({default: mod.Confetti})
);| css={css` | ||
| margin: ${euiTheme.size.m}; | ||
| padding: ${euiTheme.size.s}; | ||
| ${showTopDivider && `border-top: 1px ${euiTheme.colors.borderBaseSubdued} solid;`} |
There was a problem hiding this comment.
nit: isn't 1px a border width on euiTheme, as well?
| ${showTopDivider && `border-top: 1px ${euiTheme.colors.borderBaseSubdued} solid;`} | |
| ${showTopDivider && `border-top: ${euiTheme.border.width.thin} ${euiTheme.colors.borderBaseSubdued} solid;`} |
There was a problem hiding this comment.
@eokoneyo Shouldn't this have thrown an eslint warning?
| } from '@elastic/eui'; | ||
| import { FormattedMessage } from '@kbn/i18n-react'; | ||
| import type { FeedbackView } from './feedback_snippet'; | ||
| import Confetti from './confetti/confetti'; |
There was a problem hiding this comment.
nit: prefer a barrel import. If you're importing the non-lazy component, export it from the barrel as ConfettiComponent.
There was a problem hiding this comment.
Oh yes, thanks for noticing!
| feedbackSnippetId={feedbackSnippetId} | ||
| promptViewMessage={promptViewMessage} | ||
| surveyUrl={feedbackSurveyUrl} | ||
| showFeedbackButtonTopDivider={true} |
There was a problem hiding this comment.
Another option would be to encapsulate this change with some more expressive prop, like type or contained. For example, if we want to include a top divider when the FeedbackSnippet is contained within a panel, you can use "contained", or similar.
In other words, add a more expressive prop. From this, I don't know why I would or would not set this prop.
|
|
||
| const LazyConfetti = lazy(() => import('./confetti')); | ||
|
|
||
| export const Confetti = () => ( |
There was a problem hiding this comment.
nit: exports need documentation.
599446a to
82bf2d9
Compare
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
cc @angeles-mb |
Closes elastic#234863 ## Summary - Added feedback snippet to our Storybook with custom controls to test props - Integrated some UI tweaks suggested by @ek-so elastic#234499 - A top divider for the feedback button - Smaller buttons ## Testing Tested divider on scrollable submenus: <img width="743" height="1051" alt="Screenshot 2025-09-16 at 12 05 47" src="https://github.com/user-attachments/assets/75589637-9adc-4bfb-99a1-ccccf50b00e9" /> Tested divider on non-scrollable submenus: <img width="743" height="1043" alt="Screenshot 2025-09-16 at 13 06 05" src="https://github.com/user-attachments/assets/69ba7b47-b3e0-4624-aa1a-0d1ea7f32e6b" /> Storybook looks: <img width="895" height="1019" alt="Screenshot 2025-09-16 at 12 07 13" src="https://github.com/user-attachments/assets/dba37ae4-9055-4b6b-8494-870c35f81890" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes #234863 ## Summary - Added feedback snippet to our Storybook with custom controls to test props - Integrated some UI tweaks suggested by @ek-so #234499 - A top divider for the feedback button - Smaller buttons ## Testing Tested divider on scrollable submenus: <img width="743" height="1051" alt="Screenshot 2025-09-16 at 12 05 47" src="https://github.com/user-attachments/assets/75589637-9adc-4bfb-99a1-ccccf50b00e9" /> Tested divider on non-scrollable submenus: <img width="743" height="1043" alt="Screenshot 2025-09-16 at 13 06 05" src="https://github.com/user-attachments/assets/69ba7b47-b3e0-4624-aa1a-0d1ea7f32e6b" /> Storybook looks: <img width="895" height="1019" alt="Screenshot 2025-09-16 at 12 07 13" src="https://github.com/user-attachments/assets/dba37ae4-9055-4b6b-8494-870c35f81890" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
|
|
||
| return ( | ||
| <FeedbackSnippet | ||
| css={css` |
There was a problem hiding this comment.
@angeles-mb this border should likely be on side nav side, and removed in high contrast mode.
There was a problem hiding this comment.
Adding this on the side nav side will also add it for the feedback panel. Is this what we want?
I think the panel looks better without it but let me know your thoughts @ek-so @weronikaolejniczak
There was a problem hiding this comment.
@angeles-mb IMO the panel looks better without it as well.
Because we want to expose this panel slot for solution teams to possibly put rich content there, would we need the separation? That is also something to consider.
There was a problem hiding this comment.
@angeles-mb Wait, I'm confused 🤔 Looking at the code, FeedbackSnippet encompasses the whole feedback including the "Navigation feedback" redirection button. So how is adding the border-top different here than adding it to sidePanelFooter slot?
There was a problem hiding this comment.
@weronikaolejniczak That's because the className styles are intentionally not being propagated to the FeedbackPanel but only to the FeedbackButton.
My initial approach was to have a specific boolean prop to decide whether to show the divider or not for the button. See here. I know the current approach is not transparent for FeedbackSnippet consumers.
In any case, I'm ok with moving it to the SideNav if that is what we want for both flavors and for other potential content on that footer.
There was a problem hiding this comment.
@angeles-mb hmm I don't like either option, to be honest - a boolean flag or CSS override. It's not immediately clear that FeedbackPanel doesn't inherit these styles. IMHO it's side nav container that should say "I want there to be a border between the menu and footer slot" regardless of the footer slot content. It feels more expected.
That being said, the result would be ☝🏻 and I agree with you, probably @ek-so does as well, that it doesn't look good. So let's leave it as is for now 😄 Thanks for explaining!
There was a problem hiding this comment.
Yes, we have a lot of borders everywhere... cleaner without it here 🙈
| onClick={handleOpenSurvey} | ||
| css={css` | ||
| width: 100%; | ||
| padding: ${euiTheme.size.s}; |
There was a problem hiding this comment.
@ek-so is this expected to be overriding the padding of the EuiButtonEmpty? 🤔 The way I see it the consumer should just be able to say size="s" and everything adjust accordingly. Otherwise, we introduce inconsistencies.
There was a problem hiding this comment.
Tbh I don't understand what does this prop do here (I mean, literally, does it have any visual effect)? To me it looks like it doesn't 🤔
There was a problem hiding this comment.
Thanks for reviewing! This padding was coming from your original PR @ek-so but it's true that it doesn't add much as you mentioned: button and container sizes are the same with (left) and without (right) the padding:

We can easily remove the padding.
There was a problem hiding this comment.
@angeles-mb perfect! Thanks for checking, Angeles.
There was a problem hiding this comment.
Thank you both! It seems, I forgot to remove 🙈
Closes elastic#234863 ## Summary - Added feedback snippet to our Storybook with custom controls to test props - Integrated some UI tweaks suggested by @ek-so elastic#234499 - A top divider for the feedback button - Smaller buttons ## Testing Tested divider on scrollable submenus: <img width="743" height="1051" alt="Screenshot 2025-09-16 at 12 05 47" src="https://github.com/user-attachments/assets/75589637-9adc-4bfb-99a1-ccccf50b00e9" /> Tested divider on non-scrollable submenus: <img width="743" height="1043" alt="Screenshot 2025-09-16 at 13 06 05" src="https://github.com/user-attachments/assets/69ba7b47-b3e0-4624-aa1a-0d1ea7f32e6b" /> Storybook looks: <img width="895" height="1019" alt="Screenshot 2025-09-16 at 12 07 13" src="https://github.com/user-attachments/assets/dba37ae4-9055-4b6b-8494-870c35f81890" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes #234863
Summary
Testing
Tested divider on scrollable submenus:
Tested divider on non-scrollable submenus:
Storybook looks: