Implement new design for "Refetch all" (#36172)

This commit is contained in:
diondiondion authored and GitHub committed 2025-09-24 09:54:07 +00:00
1 parent 29d9f81e42
commit 3a81ee8f5b
7 files changed
+254 -50

No files matched your search

@@ -8,6 +8,7 @@ const meta = {
component: Alert,
args: {
isActive: true,
isLoading: false,
animateFrom: 'side',
title: '',
message: '',
@@ -20,6 +21,12 @@ const meta = {
type: 'boolean',
description: 'Animate to the active (displayed) state of the alert',
},
isLoading: {
control: 'boolean',
type: 'boolean',
description:
'Display a loading indicator in the alert, replacing the dismiss button if present',
},
animateFrom: {
control: 'radio',
type: 'string',
@@ -108,3 +115,11 @@ export const InSizedContainer: Story = {
</div>
),
};
export const WithLoadingIndicator: Story = {
args: {
...WithDismissButton.args,
isLoading: true,
},
render: InSizedContainer.render,
};
@@ -3,6 +3,7 @@ import { useIntl } from 'react-intl';
import classNames from 'classnames';
import CloseIcon from '@/material-icons/400-24px/close.svg?react';
import { LoadingIndicator } from 'mastodon/components/loading_indicator';
import { IconButton } from '../icon_button';
@@ -10,21 +11,23 @@ import { IconButton } from '../icon_button';
* Snackbar/Toast-style notification component.
*/
export const Alert: React.FC<{
isActive?: boolean;
animateFrom?: 'side' | 'below';
title?: string;
message: string;
action?: string;
onActionClick?: () => void;
onDismiss?: () => void;
isActive?: boolean;
isLoading?: boolean;
animateFrom?: 'side' | 'below';
}> = ({
isActive,
animateFrom = 'side',
title,
message,
action,
onActionClick,
onDismiss,
isActive,
isLoading,
animateFrom = 'side',
}) => {
const intl = useIntl();
@@ -51,7 +54,13 @@ export const Alert: React.FC<{
</button>
)}
{onDismiss && (
{isLoading && (
<span className='notification-bar__loading-indicator'>
<LoadingIndicator />
</span>
)}
{onDismiss && !isLoading && (
<IconButton
title={intl.formatMessage({
id: 'dismissable_banner.dismiss',