prefixing BASE URL for images. will break existing hardcoded outside images
This commit is contained in:
@@ -25,7 +25,11 @@ export default function ArticleCardSize4({
|
|||||||
<CardMedia
|
<CardMedia
|
||||||
component="img"
|
component="img"
|
||||||
alt="green iguana"
|
alt="green iguana"
|
||||||
image={article.img}
|
image={(
|
||||||
|
import.meta.env.VITE_API_BASE_URL.replace(/\/+$/, "") +
|
||||||
|
"/" +
|
||||||
|
(article.img?.replace(/^\/+/, "") || "")
|
||||||
|
)}
|
||||||
sx={{
|
sx={{
|
||||||
height: { sm: 'auto', md: '50%' },
|
height: { sm: 'auto', md: '50%' },
|
||||||
aspectRatio: { sm: '16 / 9', md: '' },
|
aspectRatio: { sm: '16 / 9', md: '' },
|
||||||
|
|||||||
@@ -25,7 +25,11 @@ export default function ArticleCardSize6({
|
|||||||
<CardMedia
|
<CardMedia
|
||||||
component="img"
|
component="img"
|
||||||
alt={article.title}
|
alt={article.title}
|
||||||
image={article.img}
|
image={(
|
||||||
|
import.meta.env.VITE_API_BASE_URL.replace(/\/+$/, "") +
|
||||||
|
"/" +
|
||||||
|
(article.img?.replace(/^\/+/, "") || "")
|
||||||
|
)}
|
||||||
sx={{
|
sx={{
|
||||||
aspectRatio: '16 / 9',
|
aspectRatio: '16 / 9',
|
||||||
borderBottom: '1px solid',
|
borderBottom: '1px solid',
|
||||||
|
|||||||
@@ -30,12 +30,11 @@ export function ArticleMeta({
|
|||||||
<Avatar
|
<Avatar
|
||||||
key={index}
|
key={index}
|
||||||
alt={author.name}
|
alt={author.name}
|
||||||
src={
|
src={(
|
||||||
(import.meta.env.VITE_API_BASE_URL.replace(/\/+$/, "") +
|
import.meta.env.VITE_API_BASE_URL.replace(/\/+$/, "") +
|
||||||
"/" +
|
"/" +
|
||||||
(author.avatar?.replace(/^\/+/, "") || "")
|
(author.avatar?.replace(/^\/+/, "") || "")
|
||||||
)
|
)}
|
||||||
}
|
|
||||||
sx={{ width: 24, height: 24 }}
|
sx={{ width: 24, height: 24 }}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -75,7 +75,11 @@ function Author({ authors }: { authors: { name: string; avatar: string }[] }) {
|
|||||||
<Avatar
|
<Avatar
|
||||||
key={index}
|
key={index}
|
||||||
alt={author.name}
|
alt={author.name}
|
||||||
src={author.avatar}
|
src={(
|
||||||
|
import.meta.env.VITE_API_BASE_URL.replace(/\/+$/, "") +
|
||||||
|
"/" +
|
||||||
|
(author.avatar?.replace(/^\/+/, "") || "")
|
||||||
|
)}
|
||||||
sx={{ width: 24, height: 24 }}
|
sx={{ width: 24, height: 24 }}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user