14 lines
300 B
TypeScript
14 lines
300 B
TypeScript
export const calculateDimensions = (
|
|
maxWidth: number,
|
|
originalHeight: number,
|
|
originalWidth: number,
|
|
) => {
|
|
const aspectRatio = originalWidth / originalHeight
|
|
const newHeight = maxWidth / aspectRatio
|
|
const newWidth = maxWidth
|
|
return {
|
|
width: newWidth,
|
|
height: newHeight,
|
|
}
|
|
}
|