File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
frontends/ol-components/src/components/Banner Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 11NODE_ENV = development
22PORT = 8062
33SENTRY_ENV = dev # Re-enable sentry
4- NEXT_PUBLIC_OPTIMIZE_IMAGES = " true "
4+ NEXT_PUBLIC_OPTIMIZE_IMAGES = " false "
55
66# Environment variables with `NEXT_PUBLIC_` prefix are exposed to the client side
77NEXT_PUBLIC_ORIGIN = ${ MITOL_APP_BASE_URL }
Original file line number Diff line number Diff line change @@ -11,11 +11,21 @@ const SubHeader = styled(Typography)({
1111} )
1212
1313type BannerBackgroundProps = {
14+ /**
15+ * Background image src, url(...), or image-set(...).
16+ */
1417 backgroundUrl ?: string
1518 backgroundSize ?: string
1619 backgroundDim ?: number
1720}
1821
22+ const standardizeBackgroundUrl = ( url : string ) => {
23+ if ( url . startsWith ( "url(" ) || url . startsWith ( "image-set(" ) ) {
24+ return url
25+ }
26+ return url . startsWith ( "image-set(" ) ? url : `url('${ url } ')`
27+ }
28+
1929/**
2030 * This is a full-width banner component that takes a background image URL.
2131 */
@@ -26,9 +36,7 @@ const BannerBackground = styled.div<BannerBackgroundProps>(
2636 backgroundSize = "cover" ,
2737 backgroundDim = 0 ,
2838 } ) => {
29- const backgroundUrlFn = backgroundUrl . startsWith ( "image-set(" )
30- ? backgroundUrl
31- : `url('${ backgroundUrl } ')`
39+ const backgroundUrlFn = standardizeBackgroundUrl ( backgroundUrl )
3240
3341 return {
3442 backgroundAttachment : "fixed" ,
You can’t perform that action at this time.
0 commit comments