Skip to content

Commit

Permalink
chore: add beta badge to event timeline in new in unleash
Browse files Browse the repository at this point in the history
  • Loading branch information
nunogois committed Oct 7, 2024
1 parent e1f3315 commit 62e8cf4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ type NewItem = {
show: boolean;
longDescription: ReactNode;
preview?: ReactNode;
beta?: boolean;
};

interface INewInUnleashProps {
Expand Down Expand Up @@ -174,6 +175,7 @@ export const NewInUnleash = ({
</p>
</>
),
beta: true,
},
];

Expand Down Expand Up @@ -218,6 +220,7 @@ export const NewInUnleash = ({
docsLink,
preview,
summary,
beta = false,
}) => (
<NewInUnleashItem
key={label}
Expand All @@ -243,6 +246,7 @@ export const NewInUnleash = ({
longDescription={longDescription}
docsLink={docsLink}
summary={summary}
beta={beta}
/>
),
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
} from '@mui/material';
import Close from '@mui/icons-material/Close';
import { NewInUnleashTooltip } from './NewInUnleashTooltip';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { Badge } from 'component/common/Badge/Badge';

const StyledItemButton = styled(ListItemButton)(({ theme }) => ({
outline: `1px solid ${theme.palette.divider}`,
Expand All @@ -26,6 +28,12 @@ const LabelWithSummary = styled('div')(({ theme }) => ({
flex: 1,
}));

const StyledItemTitle = styled('div')(({ theme }) => ({
display: 'flex',
gap: theme.spacing(1),
alignItems: 'center',
}));

const StyledItemButtonClose = styled(IconButton)(({ theme }) => ({
padding: theme.spacing(0.25),
}));
Expand All @@ -40,6 +48,7 @@ interface INewInUnleashItemProps {
docsLink: string;
preview?: ReactNode;
summary: string;
beta: boolean;
}

const useTooltip = () => {
Expand All @@ -66,6 +75,7 @@ export const NewInUnleashItem = ({
docsLink,
preview,
summary,
beta,
}: INewInUnleashItemProps) => {
const { open, handleTooltipOpen, handleTooltipClose } = useTooltip();

Expand All @@ -90,13 +100,20 @@ export const NewInUnleashItem = ({
onCheckItOut={onCheckItOut}
docsLink={docsLink}
preview={preview}
beta={beta}
>
<StyledItemButton>
{icon}
<LabelWithSummary>
<Typography fontWeight='bold' fontSize='small'>
{label}
</Typography>
<StyledItemTitle>
<ConditionallyRender
condition={beta}
show={<Badge color='secondary'>Beta</Badge>}
/>
<Typography fontWeight='bold' fontSize='small'>
{label}
</Typography>
</StyledItemTitle>
<Typography fontSize='small'>{summary}</Typography>
</LabelWithSummary>
<Tooltip title='Dismiss' arrow sx={{ marginLeft: 'auto' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
import type { Link as RouterLink } from 'react-router-dom';
import OpenInNew from '@mui/icons-material/OpenInNew';
import { ReactComponent as UnleashLogo } from 'assets/img/logoWithWhiteText.svg';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { Badge } from 'component/common/Badge/Badge';

const Header = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.primary.light,
Expand Down Expand Up @@ -85,6 +87,7 @@ export const NewInUnleashTooltip: FC<{
open: boolean;
preview?: ReactNode;
onClose: () => void;
beta: boolean;
}> = ({
children,
title,
Expand All @@ -94,6 +97,7 @@ export const NewInUnleashTooltip: FC<{
preview,
open,
onClose,
beta,
}) => (
<HtmlTooltip
disableFocusListener
Expand All @@ -119,6 +123,10 @@ export const NewInUnleashTooltip: FC<{
)}
</Header>
<Body>
<ConditionallyRender
condition={beta}
show={<Badge color='secondary'>Beta</Badge>}
/>
<Title>{title}</Title>
<LongDescription>{longDescription}</LongDescription>
<ReadMore>
Expand Down

0 comments on commit 62e8cf4

Please sign in to comment.