UNPKG

@kiwicom/smart-faq

Version:

Smart FAQ

57 lines (50 loc) 1.36 kB
// @flow import * as React from 'react'; import { Text } from '@kiwicom/orbit-components'; import { withRouter } from 'react-router-dom'; import Translate from '@kiwicom/nitro/lib/components/Translate'; import { withLogout } from '../../context/BookingState'; import type { onLogout } from '../../../types'; import { simpleTracker } from '../../../shared/helpers/analytics/trackers'; import { track } from '../../../shared/cuckoo/tracker'; type Props = {| onLogout: onLogout, history: { push: string => void, }, |}; class SignOutButton extends React.Component<Props> { onSignOut = async () => { await this.props.onLogout(); this.props.history.push('/'); simpleTracker('smartFAQBookingOverview', { action: 'signOut', }); track('Login', 'signOut'); }; render() { return ( <div className="signOut" onClick={this.onSignOut} onKeyUp={this.onSignOut} role="button" tabIndex={0} data-cy="sign-out-button" > <Text type="attention"> <Translate t={__('smartfaq.header.sign_out')} /> </Text> <style jsx> {` .signOut { cursor: pointer; font-weight: bold; } `} </style> </div> ); } } export default withRouter(withLogout(SignOutButton));