2017-09-04 00:27:12 +00:00
|
|
|
// @flow
|
2018-05-05 23:16:08 +00:00
|
|
|
import * as React from 'react';
|
2017-09-04 00:27:12 +00:00
|
|
|
import styled from 'styled-components';
|
2017-10-27 05:42:08 +00:00
|
|
|
import { color } from 'shared/styles/constants';
|
2018-05-06 21:01:28 +00:00
|
|
|
import { ExpandedIcon } from 'outline-icons';
|
2017-10-29 22:02:24 +00:00
|
|
|
import Flex from 'shared/components/Flex';
|
2017-11-27 02:09:55 +00:00
|
|
|
import TeamLogo from './TeamLogo';
|
2017-09-04 00:27:12 +00:00
|
|
|
|
|
|
|
type Props = {
|
2017-11-27 02:09:55 +00:00
|
|
|
teamName: string,
|
|
|
|
subheading: string,
|
2018-05-12 18:09:59 +00:00
|
|
|
showDisclosure?: boolean,
|
2017-11-27 02:09:55 +00:00
|
|
|
logoUrl: string,
|
2017-09-04 00:27:12 +00:00
|
|
|
};
|
|
|
|
|
2018-05-12 18:09:59 +00:00
|
|
|
function HeaderBlock({
|
|
|
|
showDisclosure,
|
|
|
|
teamName,
|
|
|
|
subheading,
|
|
|
|
logoUrl,
|
|
|
|
...rest
|
|
|
|
}: Props) {
|
2017-09-04 00:27:12 +00:00
|
|
|
return (
|
2017-11-27 02:09:55 +00:00
|
|
|
<Header justify="flex-start" align="center" {...rest}>
|
|
|
|
<TeamLogo src={logoUrl} />
|
2017-09-04 19:26:00 +00:00
|
|
|
<Flex align="flex-start" column>
|
2018-05-12 18:09:59 +00:00
|
|
|
<TeamName showDisclosure>
|
|
|
|
{teamName}{' '}
|
|
|
|
{showDisclosure && <StyledExpandedIcon color={color.text} />}
|
2018-05-06 21:01:28 +00:00
|
|
|
</TeamName>
|
2017-11-27 02:09:55 +00:00
|
|
|
<Subheading>{subheading}</Subheading>
|
2017-09-04 00:27:12 +00:00
|
|
|
</Flex>
|
|
|
|
</Header>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-05-06 21:01:28 +00:00
|
|
|
const StyledExpandedIcon = styled(ExpandedIcon)`
|
|
|
|
position: relative;
|
|
|
|
top: 6px;
|
|
|
|
left: -4px;
|
|
|
|
`;
|
|
|
|
|
2017-11-27 02:09:55 +00:00
|
|
|
const Subheading = styled.div`
|
|
|
|
padding-left: 10px;
|
|
|
|
font-size: 11px;
|
|
|
|
text-transform: uppercase;
|
|
|
|
font-weight: 500;
|
|
|
|
color: ${color.slateDark};
|
2017-09-04 06:03:49 +00:00
|
|
|
`;
|
|
|
|
|
2017-09-04 15:32:31 +00:00
|
|
|
const TeamName = styled.div`
|
2017-11-27 02:09:55 +00:00
|
|
|
padding-left: 10px;
|
2018-05-12 18:09:59 +00:00
|
|
|
margin-top: ${props => (props.showDisclosure ? '-8px' : '0')};
|
2017-11-27 02:09:55 +00:00
|
|
|
font-weight: 600;
|
2017-09-04 00:27:12 +00:00
|
|
|
color: ${color.text};
|
|
|
|
text-decoration: none;
|
|
|
|
font-size: 16px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Header = styled(Flex)`
|
|
|
|
flex-shrink: 0;
|
2017-09-25 03:03:03 +00:00
|
|
|
padding: 16px 24px;
|
2017-09-04 06:03:49 +00:00
|
|
|
position: relative;
|
|
|
|
cursor: pointer;
|
|
|
|
width: 100%;
|
|
|
|
|
2017-09-04 15:32:31 +00:00
|
|
|
&:active,
|
2017-09-04 06:03:49 +00:00
|
|
|
&:hover {
|
2017-11-27 02:09:55 +00:00
|
|
|
transition: background 100ms ease-in-out;
|
2017-11-10 22:14:30 +00:00
|
|
|
background: rgba(0, 0, 0, 0.05);
|
2017-09-04 06:03:49 +00:00
|
|
|
}
|
2017-09-04 00:27:12 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
export default HeaderBlock;
|