UNPKG

khamba

Version:

A cli tool for sharing files through local network.

25 lines (24 loc) 797 B
import React, { useState, useEffect } from 'react'; import { Text } from 'ink'; export const arrowCharacters = { plane: '✈', triangle: '▶', bullet: '➤', }; const SendArrowAnimation = ({ arrow = arrowCharacters.triangle, speed = 50, }) => { const [indentLevel, setIndentLevel] = useState(0); useEffect(() => { const interval = setInterval(() => { setIndentLevel(prevLevel => (prevLevel + 1) % 10); }, speed); return () => clearInterval(interval); }, []); const renderArrow = () => { const indent = ' '.repeat(indentLevel * 1); return (React.createElement(Text, null, indent, arrow)); }; return React.createElement(Text, null, renderArrow()); }; export default SendArrowAnimation;