2023-10-06 13:44:06 +11:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Box, as, toRem } from 'folds';
|
|
|
|
|
import * as css from './TypingIndicator.css';
|
|
|
|
|
|
|
|
|
|
export type TypingIndicatorProps = {
|
|
|
|
|
size?: '300' | '400';
|
2024-05-31 19:49:46 +05:30
|
|
|
disableAnimation?: boolean;
|
2023-10-06 13:44:06 +11:00
|
|
|
};
|
|
|
|
|
|
2024-05-31 19:49:46 +05:30
|
|
|
export const TypingIndicator = as<'div', TypingIndicatorProps>(
|
|
|
|
|
({ size, disableAnimation, style, ...props }, ref) => (
|
|
|
|
|
<Box
|
|
|
|
|
as="span"
|
|
|
|
|
alignItems="Center"
|
|
|
|
|
shrink="No"
|
|
|
|
|
style={{ gap: toRem(size === '300' ? 1 : 2), ...style }}
|
|
|
|
|
{...props}
|
|
|
|
|
ref={ref}
|
|
|
|
|
>
|
|
|
|
|
<span className={css.TypingDot({ size, index: '0', animated: !disableAnimation })} />
|
|
|
|
|
<span className={css.TypingDot({ size, index: '1', animated: !disableAnimation })} />
|
|
|
|
|
<span className={css.TypingDot({ size, index: '2', animated: !disableAnimation })} />
|
|
|
|
|
</Box>
|
|
|
|
|
)
|
|
|
|
|
);
|