Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ImageLoaderProps } from 'next/image'
|
||||
import { ImageLoaderProps } from "next/image"
|
||||
|
||||
export const imageLoader =
|
||||
({
|
||||
@@ -9,18 +9,18 @@ export const imageLoader =
|
||||
}) =>
|
||||
({ quality, src, width }: ImageLoaderProps) => {
|
||||
const isAbsoluteUrl =
|
||||
src.startsWith('https://') || src.startsWith('http://')
|
||||
const hasQS = src.indexOf('?') !== -1
|
||||
src.startsWith("https://") || src.startsWith("http://")
|
||||
const hasQS = src.indexOf("?") !== -1
|
||||
|
||||
if (
|
||||
dimensions &&
|
||||
isLargerThanAspectRatio(dimensions, '3:2') &&
|
||||
isLargerThanAspectRatio(dimensions, "3:2") &&
|
||||
width < dimensions.width
|
||||
) {
|
||||
// If image is wider than 3:2, compensate for low height when rendering in a 3:2 container
|
||||
const scale = width / dimensions.width
|
||||
const minWidthFor32Aspect =
|
||||
dimensions.height * scale * aspectRatios['3:2'] * 2
|
||||
dimensions.height * scale * aspectRatios["3:2"] * 2
|
||||
|
||||
width = Math.max(minWidthFor32Aspect, width)
|
||||
}
|
||||
@@ -33,14 +33,14 @@ export const imageLoader =
|
||||
width = roundToNearest(width, 10)
|
||||
|
||||
if (isAbsoluteUrl) {
|
||||
return `https://img.scandichotels.com/.netlify/images?url=${src}&w=${width}${quality ? '&q=' + quality : ''}`
|
||||
return `https://img.scandichotels.com/.netlify/images?url=${src}&w=${width}${quality ? "&q=" + quality : ""}`
|
||||
}
|
||||
|
||||
return `${src}${hasQS ? '&' : '?'}w=${width}${quality ? '&q=' + quality : ''}`
|
||||
return `${src}${hasQS ? "&" : "?"}w=${width}${quality ? "&q=" + quality : ""}`
|
||||
}
|
||||
|
||||
const aspectRatios = {
|
||||
'3:2': 3 / 2,
|
||||
"3:2": 3 / 2,
|
||||
}
|
||||
function isLargerThanAspectRatio(
|
||||
dimensions: {
|
||||
|
||||
Reference in New Issue
Block a user