Functions
The functions of @poltura/theme-sdk/media.
On this page
import { … } from '@poltura/theme-sdk/media';asset
A reference to a file under the theme's assets/ folder, by its path there.
asset(path: string): AssetRefParameters
path: string: The path insideassets/, such asimages/hero.jpg.
Returns: The asset:// reference that MediaImage and image settings resolve.
Example
import { MediaImage, asset } from '@poltura/theme-sdk/media';
export function Logo() {
return <MediaImage image={asset('images/logo.png')} role='logo' alt='' />;
}mediaUrl
The URL of one rendition of a stored image; any other URL comes back as it is.
mediaUrl(src: string, role: MediaRole): stringParameters
src: string: The stored image URL.role: MediaRole: The rendition to load.
Returns: The rendition's URL, or src itself when it is not a store image.