feat(core): new empty states for doc/collection/tag (#8197)

AF-1329, AF-1330
This commit is contained in:
CatsJuice
2024-09-11 10:48:52 +00:00
parent f12655655e
commit b7d05d2078
49 changed files with 656 additions and 456 deletions

View File

@@ -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';

View File

@@ -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,

View 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} />;
}
);

View File

@@ -1,2 +1,3 @@
export * from './observe-resize';
export { startScopedViewTransition } from './view-transition';
export * from './with-unit';