bigbuffet-rw/app/soapbox/utils/media_aspect_ratio.ts
marcin mikołajczak 2943b91034 Typescript, convert some components to functional
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-04-11 21:58:48 +02:00

17 lines
485 B
TypeScript

export const minimumAspectRatio = 9 / 16; // Portrait phone
export const maximumAspectRatio = 10; // Generous min-height
export const isPanoramic = (ar: number) => {
if (isNaN(ar)) return false;
return ar >= maximumAspectRatio;
};
export const isPortrait = (ar: number) => {
if (isNaN(ar)) return false;
return ar <= minimumAspectRatio;
};
export const isNonConformingRatio = (ar: number) => {
if (isNaN(ar)) return false;
return !isPanoramic(ar) && !isPortrait(ar);
};