mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
feat(core): new empty states for doc/collection/tag (#8197)
AF-1329, AF-1330
This commit is contained in:
@@ -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} />;
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user