import {
  responsiveHeight as _responsiveHeight,
  responsiveWidth as _responsiveWidth,
  responsiveFontSize as _responsiveFontSize,
} from "react-native-responsive-dimensions";

import {
  isWeb,
  isDesktop,
  isLargeDesktop,
  isSmallDesktop,
  isSuperSmallDesktop,
} from "../hooks/useLayoutType";

export const reductionCoeff = (bypass) =>
  bypass ? 1 : isLargeDesktop ? 3 : isSmallDesktop ? 2.2 : isDesktop ? 2.8 : 1;

export const responsiveHeight = (height, bypass = false) => {
  return _responsiveHeight(height) / reductionCoeff(bypass);
};

export const responsiveWidth = (width, bypass = false) => {
  return _responsiveWidth(width) / reductionCoeff(bypass);
};

export const responsiveFontSize = (fontSize, bypass = false) => {
  if (isWeb) {
    if (isSuperSmallDesktop) {
      return fontSize * 6;
    } else if (isSmallDesktop) {
      return fontSize * 7;
    } else {
      return fontSize * 7.5;
    }
  } else {
    return _responsiveFontSize(fontSize) / reductionCoeff(bypass);
  }
};

// test
