You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
579 B
19 lines
579 B
import useSettings from '@app/hooks/useSettings';
|
|
import type { ImageProps } from 'next/image';
|
|
import Image from 'next/image';
|
|
|
|
/**
|
|
* The CachedImage component should be used wherever
|
|
* we want to offer the option to locally cache images.
|
|
*
|
|
* It uses the `next/image` Image component but overrides
|
|
* the `unoptimized` prop based on the application setting `cacheImages`.
|
|
**/
|
|
const CachedImage = (props: ImageProps) => {
|
|
const { currentSettings } = useSettings();
|
|
|
|
return <Image unoptimized={!currentSettings.cacheImages} {...props} />;
|
|
};
|
|
|
|
export default CachedImage;
|