import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';

/**
 * Calculates the image width for previously resized images.
 *
 * Wide and full-width images are always that size (960px and 100%); there is
 * no distinction between max-width and width.
 * @param layout
 * @param width
 * @param containerWidth
 * @example
 */
export function calcResizedWidth(layout, width) {
  var containerWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  switch (layout) {
    case 'wide':
      return calcWideWidth(containerWidth);
    case 'full-width':
      return calcBreakoutWidth(layout, containerWidth);
    default:
      return "".concat(width, "px");
  }
}