This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/components/Tab.js

47 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-08-10 06:14:51 +00:00
// @flow
import * as React from "react";
import styled, { withTheme } from "styled-components";
import { NavLink } from "react-router-dom";
import { lighten } from "polished";
2018-08-10 06:14:51 +00:00
type Props = {
theme: Object,
};
const StyledNavLink = styled(NavLink)`
position: relative;
bottom: -1px;
2018-08-10 06:14:51 +00:00
display: inline-block;
font-weight: 500;
font-size: 14px;
color: ${(props) => props.theme.textTertiary};
2019-01-08 07:42:55 +00:00
margin-right: 24px;
2018-08-10 06:14:51 +00:00
padding-bottom: 8px;
2019-01-08 07:42:55 +00:00
&:hover {
color: ${(props) => props.theme.textSecondary};
border-bottom: 3px solid ${(props) => props.theme.divider};
padding-bottom: 5px;
2019-01-08 07:42:55 +00:00
}
&:focus {
outline: none;
border-bottom: 3px solid
${(props) => lighten(0.4, props.theme.buttonBackground)};
padding-bottom: 5px;
}
2018-08-10 06:14:51 +00:00
`;
function Tab({ theme, ...rest }: Props) {
2018-08-10 06:14:51 +00:00
const activeStyle = {
paddingBottom: "5px",
borderBottom: `3px solid ${theme.textSecondary}`,
color: theme.textSecondary,
2018-08-10 06:14:51 +00:00
};
return <StyledNavLink {...rest} activeStyle={activeStyle} />;
2018-08-10 06:14:51 +00:00
}
export default withTheme(Tab);