How to use the @brainly/html-sketchapp.Page function in @brainly/html-sketchapp

To help you get started, we’ve selected a few @brainly/html-sketchapp 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 brainly / html-sketchapp-style-guide / src / styleguide2asketch.js View on Github external
export function getASketchPage() {
  const stylesheet = document.querySelector('head > link');
  let styleGuideVersion = '';

  if (stylesheet) {
    styleGuideVersion = stylesheet.href.match(/\/([0-9]+\.[0-9]+\.[0-9]+)\//)[1];
  }

  const page = new Page({
    width: document.body.offsetWidth,
    // eslint-disable-next-line comma-dangle
    height: document.body.offsetHeight
  });

  page.setName(`Brainly Pencil - Style Guide ${styleGuideVersion}`);

  const icons = [];
  const maskColors = [];

  // SYMBOLS
  Array.from(document.querySelectorAll('section > .item, section > .inline-item'))
    .map(metaNode => {
      const symbolNode = metaNode.firstChild;
      const name = metaNode.title;
github chrisvxd / story2sketch / src / browser / page2layers.js View on Github external
export const getPage = ({ title, width, height }) => {
  const page = new Page({
    width,
    height
  });

  page.setName(title);

  return page.toJSON();
};
github microsoft / fast-dna / packages / fast-sketch-library / src / index.ts View on Github external
(resolve: (result: string) => void, reject: (error: Error) => void): void => {
            const sketchPage: SketchPage = new SketchPage({
                width: config.pageWidth,
                height: config.pageHeight,
            });

            sketchPage.setName(config.name);

            const flattenedLayers: string[] = symbols.reduce(
                (accumulator: string[], currentValue: string[]) => {
                    return accumulator.concat(currentValue);
                },
                []
            );

            const sketchPageJson: any = sketchPage.toJSON();

            sketchPageJson.layers = flattenedLayers;