How to use the @shopify/polaris-tokens.spacingLoose function in @shopify/polaris-tokens

To help you get started, we’ve selected a few @shopify/polaris-tokens 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 Shopify / polaris-react / src / utilities / sticky-manager / sticky-manager.ts View on Github external
boundingElement,
      offset,
      disableWhenStacked,
    } = stickyItem;

    if (disableWhenStacked && stackedContent().matches) {
      return {
        sticky: false,
        top: 0,
        left: 0,
        width: 'auto',
      };
    }

    const stickyOffset = offset
      ? this.getOffset(stickyNode) + parseInt(tokens.spacingLoose, 10)
      : this.getOffset(stickyNode);

    const scrollPosition = scrollTop + stickyOffset;
    const placeHolderNodeCurrentTop =
      placeHolderNode.getBoundingClientRect().top - containerTop + scrollTop;
    const top = containerTop + stickyOffset;
    const width = placeHolderNode.getBoundingClientRect().width;
    const left = placeHolderNode.getBoundingClientRect().left;

    let sticky: boolean;

    if (boundingElement == null) {
      sticky = scrollPosition >= placeHolderNodeCurrentTop;
    } else {
      const stickyItemHeight = stickyNode.getBoundingClientRect().height;
      const stickyItemBottomPosition =
github smile-io / ember-polaris / addon / services / sticky-manager.js View on Github external
boundingElement,
      offset,
      disableWhenStacked,
    } = stickyItem;

    if (disableWhenStacked && stackedContent().matches) {
      return {
        sticky: false,
        top: 0,
        left: 0,
        width: 'auto',
      };
    }

    let stickyOffset = offset
      ? this.getOffset(stickyNode) + parseInt(tokens.spacingLoose, 10)
      : this.getOffset(stickyNode);

    let scrollPosition = scrollTop + stickyOffset;
    let placeHolderNodeCurrentTop =
      placeHolderNode.getBoundingClientRect().top - containerTop + scrollTop;
    let top = containerTop + stickyOffset;
    let width = placeHolderNode.getBoundingClientRect().width;
    let left = placeHolderNode.getBoundingClientRect().left;

    let sticky;

    if (boundingElement == null) {
      sticky = scrollPosition >= placeHolderNodeCurrentTop;
    } else {
      let stickyItemHeight = stickyNode.getBoundingClientRect().height;
      let stickyItemBottomPosition =

@shopify/polaris-tokens

[![npm version](https://img.shields.io/npm/v/@shopify/polaris-tokens.svg?style=flat)](https://www.npmjs.com/package/@shopify/polaris-tokens)

SEE LICENSE IN LICENSE.md
Latest version published 2 months ago

Package Health Score

98 / 100
Full package analysis

Similar packages