You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/components/conversation/message/message-content/MessageHighlighter.tsx

30 lines
767 B
TypeScript

import { motion } from 'framer-motion';
import { MouseEvent, ReactNode } from 'react';
import styled from 'styled-components';
const StyledMessageHighlighter = styled(motion.div)``;
export function MessageHighlighter(props: {
children: ReactNode;
highlight: boolean;
role?: string;
className?: string;
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
}) {
const { className, children, highlight, role, onClick } = props;
return (
<StyledMessageHighlighter
className={className}
role={role}
onClick={onClick}
animate={{
opacity: highlight ? [1, 0.2, 1, 0.2, 1] : undefined,
transition: { duration: 1, ease: 'linear', repeat: 0 },
}}
>
{children}
</StyledMessageHighlighter>
);
}