Skip to content

Commit

Permalink
fix: Allow relative image urls for background placeholder (#710)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Kane <[email protected]>
  • Loading branch information
ashhitch and ascorbic authored Oct 31, 2024
1 parent 74222b9 commit 22c279c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ export const getStyle = <
["object-fit", objectFit],
];

// If background is a URL, set it to cover the image and not repeat
// If background is a URL, set it to cover the image and not repeat
if (
background?.startsWith("https:") ||
background?.startsWith("http:") ||
background?.startsWith("data:")
background?.startsWith("data:") ||
background?.startsWith("/")
) {
styleEntries.push(["background-image", `url(${background})`]);
styleEntries.push(["background-size", "cover"]);
Expand Down

0 comments on commit 22c279c

Please sign in to comment.