Skip to content

Commit

Permalink
Create common active indicator icon
Browse files Browse the repository at this point in the history
  • Loading branch information
asanchezr committed Jan 16, 2025
1 parent 437d050 commit 9d92b01
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions source/frontend/src/components/common/ActiveIndicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { FaCircle } from 'react-icons/fa';
import styled from 'styled-components';

export interface IActiveIndicatorProps {
active: boolean;
title?: string;
size?: number | string;
icon?: React.ReactNode;
'data-testId'?: string;
}

export const ActiveIndicator: React.FC<IActiveIndicatorProps> = ({
active,
size,
icon,
title,
'data-testId': dataTestId,
}) => {
return (
<Container active={active ?? false} data-testid={dataTestId ?? 'active-indicator'}>
{icon ?? <FaCircle title={title ?? active ? 'Active' : 'Inactive'} size={size ?? 10} />}
</Container>
);
};

export default ActiveIndicator;

const Container = styled.div<{ active: boolean }>`
display: flex;
align-items: center;
padding-right: 0.6rem;
color: ${props =>
props.active
? props.theme.bcTokens.iconsColorSuccess
: props.theme.bcTokens.iconsColorDisabled};
`;

0 comments on commit 9d92b01

Please sign in to comment.