Skip to content

Commit

Permalink
feat: add PageTitle
Browse files Browse the repository at this point in the history
  • Loading branch information
awinogradov committed Apr 20, 2023
1 parent f14944c commit 8988050
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/CommonHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Text, nullable } from '@taskany/bricks';
import { PageContent } from './Page';

interface CommonHeaderProps {
title: string;
title: React.ReactNode;
preTitle?: React.ReactNode;
description?: React.ReactNode;
children?: React.ReactNode;
Expand Down
36 changes: 36 additions & 0 deletions src/components/PageTitle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Text } from '@taskany/bricks';
import { gray4, gray7 } from '@taskany/colors';
import styled from 'styled-components';

interface PageTitleProps {
title: string;
subtitle?: string;
onClick?: () => void;
}

const StyledText = styled(Text)`
cursor: pointer;
transition: color 200ms ease-in-out;
${({ onClick }) =>
onClick &&
`
:hover {
color: ${gray7};
}
`}
`;
export const PageTitle: React.FC<PageTitleProps> = ({ title, subtitle, onClick }) => (
<>
{title}
{subtitle && (
<>
:{' '}
<StyledText as="span" size="xxl" weight="bolder" color={onClick ? gray4 : gray7} onClick={onClick}>
{subtitle}
</StyledText>
</>
)}
</>
);

0 comments on commit 8988050

Please sign in to comment.