2017-09-04 00:27:12 +00:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
import styled from 'styled-components';
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
import { color, layout } from 'styles/constants';
|
|
|
|
import type { User, Team } from 'types';
|
|
|
|
import Flex from 'components/Flex';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
user: User,
|
|
|
|
team: Team,
|
|
|
|
children?: React$Element<any>,
|
|
|
|
};
|
|
|
|
|
|
|
|
function HeaderBlock({ user, team, children }: Props) {
|
|
|
|
return (
|
2017-09-04 06:03:49 +00:00
|
|
|
<Header justify="space-between" align="center">
|
|
|
|
<Flex align="center" column>
|
2017-09-04 00:27:12 +00:00
|
|
|
<LogoLink to="/">{team.name}</LogoLink>
|
2017-09-04 06:03:49 +00:00
|
|
|
<Name>{user.name}</Name>
|
2017-09-04 00:27:12 +00:00
|
|
|
</Flex>
|
|
|
|
{children}
|
|
|
|
</Header>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-09-04 06:03:49 +00:00
|
|
|
const Name = styled.div`
|
|
|
|
font-size: 13px;
|
|
|
|
`;
|
|
|
|
|
2017-09-04 00:27:12 +00:00
|
|
|
const LogoLink = styled(Link)`
|
|
|
|
font-family: 'Atlas Grotesk';
|
|
|
|
font-weight: bold;
|
|
|
|
color: ${color.text};
|
|
|
|
text-decoration: none;
|
|
|
|
font-size: 16px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Header = styled(Flex)`
|
|
|
|
flex-shrink: 0;
|
|
|
|
padding: ${layout.padding};
|
2017-09-04 06:03:49 +00:00
|
|
|
position: relative;
|
|
|
|
cursor: pointer;
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background: rgba(0,0,0,.05);
|
|
|
|
}
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
content: "";
|
|
|
|
left: ${layout.hpadding};
|
|
|
|
right: ${layout.hpadding};
|
|
|
|
background: rgba(0,0,0,.075);
|
|
|
|
height: 1px;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
2017-09-04 00:27:12 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
export default HeaderBlock;
|