2017-09-04 00:27:12 +00:00
|
|
|
// @flow
|
2020-08-09 05:53:59 +00:00
|
|
|
import { ExpandedIcon } from "outline-icons";
|
2020-06-20 20:59:15 +00:00
|
|
|
import * as React from "react";
|
2020-08-15 00:47:12 +00:00
|
|
|
import styled from "styled-components";
|
2020-07-10 05:33:07 +00:00
|
|
|
import Flex from "components/Flex";
|
|
|
|
import TeamLogo from "components/TeamLogo";
|
2017-09-04 00:27:12 +00:00
|
|
|
|
|
|
|
type Props = {
|
2017-11-27 02:09:55 +00:00
|
|
|
teamName: string,
|
2020-08-15 00:47:12 +00:00
|
|
|
subheading: React.Node,
|
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}>
|
2020-09-17 05:31:14 +00:00
|
|
|
<TeamLogo alt={`${teamName} logo`} src={logoUrl} size="38px" />
|
2017-09-04 19:26:00 +00:00
|
|
|
<Flex align="flex-start" column>
|
2018-05-12 18:09:59 +00:00
|
|
|
<TeamName showDisclosure>
|
2020-06-20 20:59:15 +00:00
|
|
|
{teamName}{" "}
|
2020-08-15 00:47:12 +00:00
|
|
|
{showDisclosure && <StyledExpandedIcon color="currentColor" />}
|
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)`
|
2018-05-21 03:21:39 +00:00
|
|
|
position: absolute;
|
|
|
|
right: 0;
|
|
|
|
top: 0;
|
2018-05-06 21:01:28 +00:00
|
|
|
`;
|
|
|
|
|
2017-11-27 02:09:55 +00:00
|
|
|
const Subheading = styled.div`
|
|
|
|
padding-left: 10px;
|
|
|
|
font-size: 11px;
|
|
|
|
text-transform: uppercase;
|
|
|
|
font-weight: 500;
|
2020-08-09 01:53:11 +00:00
|
|
|
color: ${(props) => props.theme.sidebarText};
|
2017-09-04 06:03:49 +00:00
|
|
|
`;
|
|
|
|
|
2017-09-04 15:32:31 +00:00
|
|
|
const TeamName = styled.div`
|
2018-05-21 03:21:39 +00:00
|
|
|
position: relative;
|
2017-11-27 02:09:55 +00:00
|
|
|
padding-left: 10px;
|
2018-05-21 03:21:39 +00:00
|
|
|
padding-right: 24px;
|
2017-11-27 02:09:55 +00:00
|
|
|
font-weight: 600;
|
2020-08-09 01:53:11 +00:00
|
|
|
color: ${(props) => props.theme.text};
|
2017-09-04 00:27:12 +00:00
|
|
|
text-decoration: none;
|
|
|
|
font-size: 16px;
|
|
|
|
`;
|
|
|
|
|
2020-09-13 06:27:23 +00:00
|
|
|
const Header = styled.button`
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2017-09-04 00:27:12 +00:00
|
|
|
flex-shrink: 0;
|
2017-09-25 03:03:03 +00:00
|
|
|
padding: 16px 24px;
|
2017-09-04 06:03:49 +00:00
|
|
|
position: relative;
|
2020-09-13 06:27:23 +00:00
|
|
|
background: none;
|
|
|
|
line-height: inherit;
|
|
|
|
border: 0;
|
|
|
|
margin: 0;
|
2017-09-04 06:03:49 +00:00
|
|
|
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
|
|
|
`;
|
|
|
|
|
2020-08-15 00:47:12 +00:00
|
|
|
export default HeaderBlock;
|