forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Stateful sidenav] Feedback button (elastic#195751)
- Loading branch information
Showing
18 changed files
with
246 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/shared-ux/chrome/navigation/src/ui/components/feedback_btn.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { EuiButton, EuiCallOut, useEuiTheme, EuiText, EuiSpacer } from '@elastic/eui'; | ||
import React, { FC, useState } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
const feedbackUrl = 'https://ela.st/nav-feedback'; | ||
const FEEDBACK_BTN_KEY = 'core.chrome.sideNav.feedbackBtn'; | ||
|
||
export const FeedbackBtn: FC = () => { | ||
const { euiTheme } = useEuiTheme(); | ||
const [showCallOut, setShowCallOut] = useState( | ||
sessionStorage.getItem(FEEDBACK_BTN_KEY) !== 'hidden' | ||
); | ||
|
||
const onDismiss = () => { | ||
setShowCallOut(false); | ||
sessionStorage.setItem(FEEDBACK_BTN_KEY, 'hidden'); | ||
}; | ||
|
||
const onClick = () => { | ||
window.open(feedbackUrl, '_blank'); | ||
onDismiss(); | ||
}; | ||
|
||
if (!showCallOut) return null; | ||
|
||
return ( | ||
<EuiCallOut | ||
color="warning" | ||
css={{ | ||
margin: `0 ${euiTheme.size.m} ${euiTheme.size.m} ${euiTheme.size.m}`, | ||
}} | ||
onDismiss={onDismiss} | ||
data-test-subj="sideNavfeedbackCallout" | ||
> | ||
<EuiText size="s" color="dimgrey"> | ||
{i18n.translate('sharedUXPackages.chrome.sideNavigation.feedbackCallout.title', { | ||
defaultMessage: `How's the navigation working for you? Missing anything?`, | ||
})} | ||
</EuiText> | ||
<EuiSpacer /> | ||
<EuiButton | ||
onClick={onClick} | ||
color="warning" | ||
iconType="popout" | ||
iconSide="right" | ||
size="s" | ||
fullWidth | ||
> | ||
{i18n.translate('sharedUXPackages.chrome.sideNavigation.feedbackCallout.btn', { | ||
defaultMessage: 'Let us know', | ||
})} | ||
</EuiButton> | ||
</EuiCallOut> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.