RefreshButton.tsx28 lines · main
| 1 | import { LoaderCircle, RefreshCcw } from 'lucide-react' |
| 2 | |
| 3 | import { ButtonTooltip } from '../ButtonTooltip' |
| 4 | |
| 5 | interface RefreshButtonProps { |
| 6 | isLoading: boolean |
| 7 | onRefresh: () => void |
| 8 | } |
| 9 | |
| 10 | export const RefreshButton = ({ isLoading, onRefresh }: RefreshButtonProps) => { |
| 11 | return ( |
| 12 | <ButtonTooltip |
| 13 | size="tiny" |
| 14 | type="default" |
| 15 | disabled={isLoading} |
| 16 | onClick={onRefresh} |
| 17 | className="w-[26px]" |
| 18 | icon={ |
| 19 | isLoading ? ( |
| 20 | <LoaderCircle className="text-foreground animate-spin" /> |
| 21 | ) : ( |
| 22 | <RefreshCcw className="text-foreground" /> |
| 23 | ) |
| 24 | } |
| 25 | tooltip={{ content: { side: 'bottom', text: 'Refresh logs' } }} |
| 26 | /> |
| 27 | ) |
| 28 | } |