menu-improves
This commit is contained in:
@@ -1,20 +1,23 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Flex from 'shared/components/Flex';
|
|
||||||
import { color } from 'shared/styles/constants';
|
import { color } from 'shared/styles/constants';
|
||||||
|
|
||||||
const DropdownMenuItem = ({
|
type Props = {
|
||||||
onClick,
|
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
onClick?: SyntheticEvent => void,
|
onClick?: SyntheticEvent => void,
|
||||||
children?: React.Element<any>,
|
children?: React.Element<any>,
|
||||||
}) => {
|
|
||||||
return <MenuItem onClick={onClick}>{children}</MenuItem>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const MenuItem = styled(Flex)`
|
const DropdownMenuItem = ({ onClick, children, ...rest }: Props) => {
|
||||||
|
return (
|
||||||
|
<MenuItem onClick={onClick} {...rest}>
|
||||||
|
{children}
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const MenuItem = styled.a`
|
||||||
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
@@ -29,11 +32,6 @@ const MenuItem = styled(Flex)`
|
|||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: ${color.white};
|
color: ${color.white};
|
||||||
background: ${color.primary};
|
background: ${color.primary};
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ import { inject, observer } from 'mobx-react';
|
|||||||
import UiStore from 'stores/UiStore';
|
import UiStore from 'stores/UiStore';
|
||||||
import AuthStore from 'stores/AuthStore';
|
import AuthStore from 'stores/AuthStore';
|
||||||
import { DropdownMenu, DropdownMenuItem } from 'components/DropdownMenu';
|
import { DropdownMenu, DropdownMenuItem } from 'components/DropdownMenu';
|
||||||
import { spectrumUrl } from '../../shared/utils/routeHelpers';
|
import {
|
||||||
|
developers,
|
||||||
|
githubIssuesUrl,
|
||||||
|
mailToUrl,
|
||||||
|
spectrumUrl,
|
||||||
|
} from '../../shared/utils/routeHelpers';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
class AccountMenu extends Component {
|
class AccountMenu extends Component {
|
||||||
@@ -24,18 +29,10 @@ class AccountMenu extends Component {
|
|||||||
this.props.history.push('/settings');
|
this.props.history.push('/settings');
|
||||||
};
|
};
|
||||||
|
|
||||||
handleApi = () => {
|
|
||||||
window.location.href = '/developers';
|
|
||||||
};
|
|
||||||
|
|
||||||
handleLogout = () => {
|
handleLogout = () => {
|
||||||
this.props.auth.logout();
|
this.props.auth.logout();
|
||||||
};
|
};
|
||||||
|
|
||||||
handleFeedback = () => {
|
|
||||||
window.location.href = spectrumUrl();
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<DropdownMenu
|
<DropdownMenu
|
||||||
@@ -48,12 +45,20 @@ class AccountMenu extends Component {
|
|||||||
<DropdownMenuItem onClick={this.handleOpenKeyboardShortcuts}>
|
<DropdownMenuItem onClick={this.handleOpenKeyboardShortcuts}>
|
||||||
Keyboard shortcuts
|
Keyboard shortcuts
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={this.handleApi}>
|
<DropdownMenuItem href={developers()} target="_blank">
|
||||||
API documentation
|
API documentation
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={this.handleFeedback}>
|
<hr />
|
||||||
Feedback
|
<DropdownMenuItem href={spectrumUrl()} target="_blank">
|
||||||
|
Community
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem href={mailToUrl()} target="_blank">
|
||||||
|
Send us feedback
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem href={githubIssuesUrl()} target="_blank">
|
||||||
|
Report a bug
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<hr />
|
||||||
<DropdownMenuItem onClick={this.handleLogout}>Logout</DropdownMenuItem>
|
<DropdownMenuItem onClick={this.handleLogout}>Logout</DropdownMenuItem>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ export function githubUrl(): string {
|
|||||||
return 'https://www.github.com/outline';
|
return 'https://www.github.com/outline';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function githubIssuesUrl(): string {
|
||||||
|
return 'https://www.github.com/outline/outline/issues';
|
||||||
|
}
|
||||||
|
|
||||||
export function blogUrl(): string {
|
export function blogUrl(): string {
|
||||||
return 'https://medium.com/getoutline';
|
return 'https://medium.com/getoutline';
|
||||||
}
|
}
|
||||||
@@ -41,6 +45,10 @@ export function spectrumUrl(): string {
|
|||||||
return 'https://spectrum.chat/outline';
|
return 'https://spectrum.chat/outline';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function mailToUrl(): string {
|
||||||
|
return 'mailto:hello@getoutline.com';
|
||||||
|
}
|
||||||
|
|
||||||
export function developers(): string {
|
export function developers(): string {
|
||||||
return '/developers';
|
return '/developers';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user