mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
feat(core): new empty states for doc/collection/tag (#8197)
AF-1329, AF-1330
This commit is contained in:
@@ -28,6 +28,7 @@ export * from './ui/slider';
|
||||
export * from './ui/switch';
|
||||
export * from './ui/table';
|
||||
export * from './ui/tabs';
|
||||
export * from './ui/themed-img';
|
||||
export * from './ui/toast';
|
||||
export * from './ui/tooltip';
|
||||
export * from './utils';
|
||||
|
||||
@@ -16,6 +16,9 @@ export type EmptyContentProps = {
|
||||
descriptionStyle?: CSSProperties;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated use different empty components for different use cases, like `EmptyDocs` for documentation empty state
|
||||
*/
|
||||
export const Empty = ({
|
||||
containerStyle,
|
||||
title,
|
||||
|
||||
17
packages/frontend/component/src/ui/themed-img/index.tsx
Normal file
17
packages/frontend/component/src/ui/themed-img/index.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { useTheme } from 'next-themes';
|
||||
import { forwardRef, type HTMLAttributes } from 'react';
|
||||
|
||||
export interface ThemedImgProps
|
||||
extends Omit<HTMLAttributes<HTMLImageElement>, 'src'> {
|
||||
lightSrc: string;
|
||||
darkSrc?: string;
|
||||
}
|
||||
|
||||
export const ThemedImg = forwardRef<HTMLImageElement, ThemedImgProps>(
|
||||
function ThemedImg({ lightSrc, darkSrc, ...attrs }, ref) {
|
||||
const { resolvedTheme } = useTheme();
|
||||
const src = resolvedTheme === 'dark' && darkSrc ? darkSrc : lightSrc;
|
||||
|
||||
return <img ref={ref} src={src} {...attrs} />;
|
||||
}
|
||||
);
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './observe-resize';
|
||||
export { startScopedViewTransition } from './view-transition';
|
||||
export * from './with-unit';
|
||||
|
||||
Reference in New Issue
Block a user