Merge pull request #643 from outline/issue-627

Clarify account dropdown
This commit is contained in:
Tom Moor
2018-05-06 17:06:16 -07:00
committed by GitHub
6 changed files with 46 additions and 6 deletions

View File

@@ -1,12 +1,39 @@
// @flow
import * as React from 'react';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import styled from 'styled-components';
const Scrollable = styled.div`
type Props = {
shadow?: boolean,
};
@observer
class Scrollable extends React.Component<Props> {
@observable shadow: boolean = false;
handleScroll = (ev: SyntheticMouseEvent<*>) => {
this.shadow = !!(this.props.shadow && ev.currentTarget.scrollTop > 0);
};
render() {
const { shadow, ...rest } = this.props;
return (
<Wrapper onScroll={this.handleScroll} shadow={this.shadow} {...rest} />
);
}
}
const Wrapper = styled.div`
height: 100%;
overflow-y: auto;
overflow-x: hidden;
overscroll-behavior: none;
-webkit-overflow-scrolling: touch;
box-shadow: ${props =>
props.shadow ? '0 1px inset rgba(0,0,0,.1)' : 'none'};
transition: all 250ms ease-in-out;
`;
export default Scrollable;

View File

@@ -52,7 +52,7 @@ class MainSidebar extends React.Component<Props> {
}
/>
<Flex auto column>
<Scrollable>
<Scrollable shadow>
<Section>
<SidebarLink to="/dashboard" icon={<HomeIcon />}>
Home

View File

@@ -36,7 +36,7 @@ class SettingsSidebar extends React.Component<Props> {
/>
<Flex auto column>
<Scrollable>
<Scrollable shadow>
<Section>
<Header>Account</Header>
<SidebarLink to="/settings" icon={<ProfileIcon />}>

View File

@@ -2,6 +2,7 @@
import * as React from 'react';
import styled from 'styled-components';
import { color } from 'shared/styles/constants';
import { ExpandedIcon } from 'outline-icons';
import Flex from 'shared/components/Flex';
import TeamLogo from './TeamLogo';
@@ -16,13 +17,21 @@ function HeaderBlock({ teamName, subheading, logoUrl, ...rest }: Props) {
<Header justify="flex-start" align="center" {...rest}>
<TeamLogo src={logoUrl} />
<Flex align="flex-start" column>
<TeamName>{teamName}</TeamName>
<TeamName>
{teamName} <StyledExpandedIcon color={color.text} />
</TeamName>
<Subheading>{subheading}</Subheading>
</Flex>
</Header>
);
}
const StyledExpandedIcon = styled(ExpandedIcon)`
position: relative;
top: 6px;
left: -4px;
`;
const Subheading = styled.div`
padding-left: 10px;
font-size: 11px;