How to use the @times-components/utils.getStandardTemplateCrop function in @times-components/utils

To help you get started, we’ve selected a few @times-components/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github newsuk / times-components / packages / article-main-standard / src / article-lead-asset / article-lead-asset-image.js View on Github external
const ArticleLeadAssetImage = ({
  caption,
  credits,
  crop11,
  crop23,
  crop32,
  crop45,
  crop169,
  crop1251,
  width
}) => {
  const crop = getStandardTemplateCrop({
    crop11,
    crop23,
    crop32,
    crop45,
    crop169,
    crop1251
  });

  if (crop === null) {
    return null;
  }

  const { ratio, url } = crop;
  const [ratioWidth, ratioHeight] = ratio.split(":");
  const aspectRatio = ratioWidth / ratioHeight;
github newsuk / times-components / packages / article-main-standard / src / article-lead-asset / article-lead-asset-video.js View on Github external
const ArticleLeadAssetVideo = ({
  brightcoveVideoId,
  brightcovePolicyKey,
  brightcoveAccountId,
  posterImage,
  onVideoPress,
  skySports
}) => {
  const crop = getStandardTemplateCrop(posterImage);
  const { ratio, url } = crop;
  const [ratioWidth, ratioHeight] = ratio.split(":");
  const aspectRatio = ratioWidth / ratioHeight;

  const width = screenWidth();
  const height = width / aspectRatio;

  return (