mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-15 00:56:26 +08:00
539b2e87ad
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a unified loading spinner icon that adapts to light or dark themes automatically. - **Refactor** - Streamlined loading icon usage across the app by replacing multiple theme-based icons with a single helper function for consistent and simplified icon management. - **Chores** - Removed an unused dependency to improve package management. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import {
|
|
EmbedCardDarkBannerIcon,
|
|
EmbedCardDarkCubeIcon,
|
|
EmbedCardDarkHorizontalIcon,
|
|
EmbedCardDarkListIcon,
|
|
EmbedCardDarkVerticalIcon,
|
|
EmbedCardLightBannerIcon,
|
|
EmbedCardLightCubeIcon,
|
|
EmbedCardLightHorizontalIcon,
|
|
EmbedCardLightListIcon,
|
|
EmbedCardLightVerticalIcon,
|
|
getLoadingIconWith,
|
|
} from '@blocksuite/affine-components/icons';
|
|
import { ColorScheme } from '@blocksuite/affine-model';
|
|
import type { TemplateResult } from 'lit';
|
|
|
|
type EmbedCardIcons = {
|
|
LoadingIcon: TemplateResult<1>;
|
|
EmbedCardBannerIcon: TemplateResult<1>;
|
|
EmbedCardHorizontalIcon: TemplateResult<1>;
|
|
EmbedCardListIcon: TemplateResult<1>;
|
|
EmbedCardVerticalIcon: TemplateResult<1>;
|
|
EmbedCardCubeIcon: TemplateResult<1>;
|
|
};
|
|
|
|
export function getEmbedCardIcons(theme: ColorScheme): EmbedCardIcons {
|
|
const LoadingIcon = getLoadingIconWith(theme);
|
|
|
|
if (theme === ColorScheme.Light) {
|
|
return {
|
|
LoadingIcon,
|
|
EmbedCardBannerIcon: EmbedCardLightBannerIcon,
|
|
EmbedCardHorizontalIcon: EmbedCardLightHorizontalIcon,
|
|
EmbedCardListIcon: EmbedCardLightListIcon,
|
|
EmbedCardVerticalIcon: EmbedCardLightVerticalIcon,
|
|
EmbedCardCubeIcon: EmbedCardLightCubeIcon,
|
|
};
|
|
} else {
|
|
return {
|
|
LoadingIcon,
|
|
EmbedCardBannerIcon: EmbedCardDarkBannerIcon,
|
|
EmbedCardHorizontalIcon: EmbedCardDarkHorizontalIcon,
|
|
EmbedCardListIcon: EmbedCardDarkListIcon,
|
|
EmbedCardVerticalIcon: EmbedCardDarkVerticalIcon,
|
|
EmbedCardCubeIcon: EmbedCardDarkCubeIcon,
|
|
};
|
|
}
|
|
}
|