How to use the @times-components/typeset.TextContainer function in @times-components/typeset

To help you get started, we’ve selected a few @times-components/typeset 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-skeleton / src / article-body / inline-paragraph.js View on Github external
tree,
  key,
  defaultFont,
  LinkComponent
}) => {
  const { spacing } = styleguide({ scale });
  const [inlineExclusion, setInlineExclusion] = useState(false);

  if (!str.length) {
    return null;
  }

  const contentWidth = Math.min(screenWidth(), tabletWidth);
  const gutters = (screenWidth() - contentWidth) / 2 + spacing(2);

  const container = new TextContainer(
    isTablet ? contentWidth : screenWidth() - spacing(4),
    10000,
    0,
    0,
    dropCap ? [dropCap.exclusion] : []
  );

  const slice = str.charAt(1) === " " ? 2 : 1;

  const manager = new LayoutManager(
    dropCap ? str.slice(slice) : str,
    [container],
    inlineExclusion ? [inlineExclusion.exclusion] : []
  );

  const positioned = manager.layout();

@times-components/typeset

A package for markup layout with arbitrary shapes

BSD-3-Clause
Latest version published 7 months ago

Package Health Score

78 / 100
Full package analysis

Similar packages