Files
twenty_crm/front/src/modules/ui/tab/components/Tab.tsx
Charles Bochet 28765fe7c3 Inbox task 2 (#991)
* Add ability to properly cast a string, number, null to an integer

* Adding Tab UI component

* Only trigger chromatic when asked
2023-07-29 21:24:33 -07:00

38 lines
1014 B
TypeScript

import * as React from 'react';
import styled from '@emotion/styled';
type OwnProps = {
title: string;
active?: boolean;
className?: string;
onClick?: () => void;
};
const StyledTab = styled.div<{ active?: boolean }>`
align-items: center;
border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
border-color: ${({ theme, active }) =>
active ? theme.border.color.inverted : 'transparent'};
color: ${({ theme, active }) =>
active ? theme.font.color.primary : theme.font.color.secondary};
cursor: pointer;
display: flex;
justify-content: center;
padding: ${({ theme }) => theme.spacing(2) + ' ' + theme.spacing(4)};
&:hover,
&:active {
border-color: ${({ theme }) => theme.border.color.inverted};
color: ${({ theme }) => theme.font.color.primary};
}
`;
export function Tab({ title, active = false, onClick, className }: OwnProps) {
return (
<StyledTab onClick={onClick} active={active} className={className}>
{title}
</StyledTab>
);
}