ImageMedia() — supabase Function Reference
Architecture documentation for the ImageMedia() function in index.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD cb9e7012_468e_2943_14d5_5e2b0d47e414["ImageMedia()"] 220cf376_6913_f930_10cc_441b6ddcb173["getClientSideURL()"] cb9e7012_468e_2943_14d5_5e2b0d47e414 -->|calls| 220cf376_6913_f930_10cc_441b6ddcb173 6215f5f8_959b_0d27_9c02_ce5f395aab88["cn()"] cb9e7012_468e_2943_14d5_5e2b0d47e414 -->|calls| 6215f5f8_959b_0d27_9c02_ce5f395aab88 style cb9e7012_468e_2943_14d5_5e2b0d47e414 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/cms/src/components/Media/ImageMedia/index.tsx lines 18–75
export const ImageMedia: React.FC<MediaProps> = (props) => {
const {
alt: altFromProps,
fill,
pictureClassName,
imgClassName,
priority,
resource,
size: sizeFromProps,
src: srcFromProps,
loading: loadingFromProps,
} = props
let width: number | undefined
let height: number | undefined
let alt = altFromProps
let src: StaticImageData | string = srcFromProps || ''
if (!src && resource && typeof resource === 'object') {
const { alt: altFromResource, height: fullHeight, url, width: fullWidth } = resource
width = fullWidth!
height = fullHeight!
alt = altFromResource || ''
const cacheTag = resource.updatedAt
src = `${getClientSideURL()}${url}?${cacheTag}`
}
const loading = loadingFromProps || (!priority ? 'lazy' : undefined)
// NOTE: this is used by the browser to determine which image to download at different screen sizes
const sizes = sizeFromProps
? sizeFromProps
: Object.entries(breakpoints)
.map(([, value]) => `(max-width: ${value}px) ${value * 2}w`)
.join(', ')
return (
<picture className={cn(pictureClassName)}>
<NextImage
alt={alt || ''}
className={cn(imgClassName)}
fill={fill}
height={!fill ? height : undefined}
placeholder="blur"
blurDataURL={placeholderBlur}
priority={priority}
quality={100}
loading={loading}
sizes={sizes}
src={src}
width={!fill ? width : undefined}
/>
</picture>
)
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does ImageMedia() do?
ImageMedia() is a function in the supabase codebase.
What does ImageMedia() call?
ImageMedia() calls 2 function(s): cn, getClientSideURL.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free