From a35314b54bcb788e8be6cc49c5e0cc6b1fbee3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20N=C3=B6ssing?= Date: Wed, 4 Sep 2024 08:04:04 +0200 Subject: [PATCH] add loading spinner component --- src/components/files/DeleteFileAction.tsx | 4 ++-- src/components/files/DownloadFileAction.tsx | 4 ++-- src/components/files/FileListItem.tsx | 4 ++-- .../loading/{IconSpinner.tsx => LoadingSpinner.tsx} | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename src/components/loading/{IconSpinner.tsx => LoadingSpinner.tsx} (85%) diff --git a/src/components/files/DeleteFileAction.tsx b/src/components/files/DeleteFileAction.tsx index b4fc522e..696ca561 100644 --- a/src/components/files/DeleteFileAction.tsx +++ b/src/components/files/DeleteFileAction.tsx @@ -2,7 +2,7 @@ import IconDelete from '@aboutbits/react-material-icons/dist/IconDeleteRoundedFi import { useState } from 'react' import { useInternationalization } from '../../framework' import { ButtonVariant } from '../button' -import { IconSpinner } from '../loading/IconSpinner' +import { LoadingSpinner } from '../loading/LoadingSpinner' import { Tone } from '../types' import { FileUploadObject } from './FileUploadState' import { ResponsiveButtonIcon } from './ResponsiveButtonIcon' @@ -35,7 +35,7 @@ export function DeleteFileAction({ setIsDeleting(false) }) }} - icon={isDeleting ? IconSpinner : IconDelete} + icon={isDeleting ? LoadingSpinner : IconDelete} label={messages['files.action.delete']} /> ) diff --git a/src/components/files/DownloadFileAction.tsx b/src/components/files/DownloadFileAction.tsx index 6996892f..ac5299cb 100644 --- a/src/components/files/DownloadFileAction.tsx +++ b/src/components/files/DownloadFileAction.tsx @@ -2,7 +2,7 @@ import IconDownload from '@aboutbits/react-material-icons/dist/IconDownloadRound import { useState } from 'react' import { useInternationalization } from '../../framework' import { ButtonVariant } from '../button' -import { IconSpinner } from '../loading/IconSpinner' +import { LoadingSpinner } from '../loading/LoadingSpinner' import { Tone } from '../types' import { FileUploadObject } from './FileUploadState' import { ResponsiveButtonIcon } from './ResponsiveButtonIcon' @@ -25,7 +25,7 @@ export function DownloadFileAction({ variant={ButtonVariant.Transparent} tone={Tone.Neutral} disabled={isDownloading} - icon={isDownloading ? IconSpinner : IconDownload} + icon={isDownloading ? LoadingSpinner : IconDownload} onClick={() => { setIsDownloading(true) Promise.resolve(onDownload(fileUploadObject)) diff --git a/src/components/files/FileListItem.tsx b/src/components/files/FileListItem.tsx index c8f8bed8..8272e4c5 100644 --- a/src/components/files/FileListItem.tsx +++ b/src/components/files/FileListItem.tsx @@ -3,7 +3,7 @@ import IconDraftRounded from '@aboutbits/react-material-icons/dist/IconDraftRoun import classNames from 'classnames' import { ReactNode, useEffect, useState } from 'react' import { useInternationalization, useTheme } from '../../framework' -import { IconSpinner } from '../loading/IconSpinner' +import { LoadingSpinner } from '../loading/LoadingSpinner' import { FileSpace, FileState, FileUploadObject } from './FileUploadState' import { useHumanReadableFileSize } from './utils' @@ -68,7 +68,7 @@ export function FileListItem({ files.icon.container.default, )} > - diff --git a/src/components/loading/IconSpinner.tsx b/src/components/loading/LoadingSpinner.tsx similarity index 85% rename from src/components/loading/IconSpinner.tsx rename to src/components/loading/LoadingSpinner.tsx index b3dfb510..b88e466c 100644 --- a/src/components/loading/IconSpinner.tsx +++ b/src/components/loading/LoadingSpinner.tsx @@ -3,7 +3,7 @@ import classNames from 'classnames' import { useTheme } from '../../framework' import { IconProps } from '../types' -export function IconSpinner({ className, ...props }: IconProps) { +export function LoadingSpinner({ className, ...props }: IconProps) { const { loading } = useTheme() return (