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