import {Component} from 'react'; import styled from '@emotion/styled'; import {logout} from 'app/actionCreators/account'; import {Client} from 'app/api'; import {IconSentry} from 'app/icons'; import {t} from 'app/locale'; type Props = { showLogout?: boolean; maxWidth?: string; }; class NarrowLayout extends Component { UNSAFE_componentWillMount() { document.body.classList.add('narrow'); } componentWillUnmount() { this.api.clear(); document.body.classList.remove('narrow'); } private api = new Client(); handleLogout = () => { logout(this.api).then(() => window.location.assign('/auth/login')); }; render() { return (
{this.props.showLogout && ( {t('Sign out')} )}
{this.props.children}
); } } const Logout = styled('span')` font-size: 16px; `; export default NarrowLayout;