Follow up from inline height #11553 related to PR #11442 we had some issues with hover styles Fixes https://github.com/twentyhq/twenty/issues/11442#issuecomment-2805893663 --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
38 lines
919 B
TypeScript
38 lines
919 B
TypeScript
import { styled } from '@linaria/react';
|
|
import { IconCheck, IconX } from 'twenty-ui/display';
|
|
import { THEME_COMMON } from 'twenty-ui/theme';
|
|
|
|
const spacing = THEME_COMMON.spacingMultiplicator * 1;
|
|
const iconSizeSm = THEME_COMMON.icon.size.sm;
|
|
|
|
const StyledBooleanFieldValue = styled.div`
|
|
margin-left: ${spacing}px;
|
|
`;
|
|
|
|
type BooleanDisplayProps = {
|
|
value: boolean | null | undefined;
|
|
};
|
|
|
|
const StyledContainer = styled.div`
|
|
height: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
`;
|
|
|
|
export const BooleanDisplay = ({ value }: BooleanDisplayProps) => {
|
|
if (value === null || value === undefined) {
|
|
return <StyledContainer />;
|
|
}
|
|
|
|
const isTrue = value === true;
|
|
|
|
return (
|
|
<StyledContainer>
|
|
{isTrue ? <IconCheck size={iconSizeSm} /> : <IconX size={iconSizeSm} />}
|
|
<StyledBooleanFieldValue>
|
|
{isTrue ? 'True' : 'False'}
|
|
</StyledBooleanFieldValue>
|
|
</StyledContainer>
|
|
);
|
|
};
|