feat: add fit in ImgThumb
This commit is contained in:
parent
d733a1c52b
commit
d611e4f4a4
|
|
@ -296,11 +296,13 @@ export const ImgThumb = ({
|
|||
url,
|
||||
w,
|
||||
h,
|
||||
fit
|
||||
}: {
|
||||
className?: string;
|
||||
url: string;
|
||||
w: number;
|
||||
h: number;
|
||||
fit?: 'cover' | 'contain',
|
||||
}) => {
|
||||
const local = useLocal({ error: false });
|
||||
return (
|
||||
|
|
@ -327,7 +329,7 @@ export const ImgThumb = ({
|
|||
local.render();
|
||||
}}
|
||||
src={siteurl(
|
||||
`/_img/${url.substring("_file/".length)}?w=${w}&h=${h}&fit=cover`
|
||||
`/_img/${url.substring("_file/".length)}?w=${w}&h=${h}&fit=${fit || 'cover'}`
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
export const baseurl = (url: string) => {
|
||||
if (location.hostname === "prasi.avolut.com") {
|
||||
const id_site = location.pathname.split("/")[2];
|
||||
return `/prod/${id_site}${url}`
|
||||
if (url.startsWith("/")) return `/prod/${id_site}${url}`;
|
||||
else return `/prod/${id_site}/${url}`;
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue