How to use @shopify/css-utilities - 10 common examples

To help you get started, we’ve selected a few @shopify/css-utilities 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 / components / Spinner / Spinner.tsx View on Github external
if (process.env.NODE_ENV === 'development') {
      // eslint-disable-next-line no-console
      console.warn(
        intl.translate('Polaris.Spinner.warningMessage', {
          color,
          size,
          colors: COLORS_FOR_LARGE_SPINNER.join(', '),
        }),
      );
    }

    // eslint-disable-next-line no-param-reassign
    size = 'small';
  }

  const className = classNames(
    styles.Spinner,
    color && styles[variationName('color', color)],
    size && styles[variationName('size', size)],
  );

  const spinnerSVG = size === 'large' ? spinnerLarge : spinnerSmall;

  return (
    <img aria-label="{accessibilityLabel}" role="status" draggable="{false}" alt="">
github Shopify / polaris-react / src / components / Spinner / Spinner.tsx View on Github external
console.warn(
        intl.translate('Polaris.Spinner.warningMessage', {
          color,
          size,
          colors: COLORS_FOR_LARGE_SPINNER.join(', '),
        }),
      );
    }

    // eslint-disable-next-line no-param-reassign
    size = 'small';
  }

  const className = classNames(
    styles.Spinner,
    color &amp;&amp; styles[variationName('color', color)],
    size &amp;&amp; styles[variationName('size', size)],
  );

  const spinnerSVG = size === 'large' ? spinnerLarge : spinnerSmall;

  return (
    <img aria-label="{accessibilityLabel}" role="status" draggable="{false}" alt="">
  );
}
github Shopify / polaris-react / src / components / Spinner / Spinner.tsx View on Github external
intl.translate('Polaris.Spinner.warningMessage', {
          color,
          size,
          colors: COLORS_FOR_LARGE_SPINNER.join(', '),
        }),
      );
    }

    // eslint-disable-next-line no-param-reassign
    size = 'small';
  }

  const className = classNames(
    styles.Spinner,
    color &amp;&amp; styles[variationName('color', color)],
    size &amp;&amp; styles[variationName('size', size)],
  );

  const spinnerSVG = size === 'large' ? spinnerLarge : spinnerSmall;

  return (
    <img aria-label="{accessibilityLabel}" role="status" draggable="{false}" alt="">
  );
}
github Shopify / polaris-react / src / components / Tabs / Tabs.tsx View on Github external
) : null;

    const tabsMarkup = visibleTabs
      .sort((tabA, tabB) =&gt; tabA - tabB)
      .map((tabIndex) =&gt; this.renderTabMarkup(tabs[tabIndex], tabIndex));

    const disclosureActivatorVisible = visibleTabs.length &lt; tabs.length;

    const classname = classNames(
      styles.Tabs,
      fitted &amp;&amp; styles.fitted,
      disclosureActivatorVisible &amp;&amp; styles.fillSpace,
    );

    const disclosureTabClassName = classNames(
      styles.DisclosureTab,
      disclosureActivatorVisible &amp;&amp; styles['DisclosureTab-visible'],
    );

    const activator = (
      <button tabindex="{-1}">
        
      </button>
    );

    return (
      <div></div>
github Shopify / polaris-react / src / components / DataTable / DataTable.tsx View on Github external
collapsed,
      columnVisibilityData,
      heights,
      sortedColumnIndex = initialSortColumnIndex,
      sortDirection = defaultSortDirection,
      isScrolledFarthestLeft,
      isScrolledFarthestRight,
    } = this.state;

    const className = classNames(
      styles.DataTable,
      collapsed &amp;&amp; styles.collapsed,
      footerContent &amp;&amp; styles.hasFooter,
    );

    const wrapperClassName = classNames(
      styles.TableWrapper,
      collapsed &amp;&amp; styles.collapsed,
    );

    const footerClassName = classNames(footerContent &amp;&amp; styles.TableFoot);

    const footerMarkup = footerContent ? (
      
        {this.renderFooter()}
      
    ) : null;

    const totalsMarkup = totals ? (
      {totals.map(this.renderTotals)}
    ) : null;
github Shopify / polaris-react / src / components / DataTable / DataTable.tsx View on Github external
isScrolledFarthestLeft,
      isScrolledFarthestRight,
    } = this.state;

    const className = classNames(
      styles.DataTable,
      collapsed &amp;&amp; styles.collapsed,
      footerContent &amp;&amp; styles.hasFooter,
    );

    const wrapperClassName = classNames(
      styles.TableWrapper,
      collapsed &amp;&amp; styles.collapsed,
    );

    const footerClassName = classNames(footerContent &amp;&amp; styles.TableFoot);

    const footerMarkup = footerContent ? (
      
        {this.renderFooter()}
      
    ) : null;

    const totalsMarkup = totals ? (
      {totals.map(this.renderTotals)}
    ) : null;

    const headingMarkup = (
      
        {headings.map((heading, headingIndex) =&gt; {
          let sortableHeadingProps;
          const id = `heading-cell-${headingIndex}`;
github Shopify / polaris-react / src / components / Badge / Badge.tsx View on Github external
function Badge({
  children,
  status,
  progress,
  size = DEFAULT_SIZE,
  polaris: {intl},
}: CombinedProps) {
  const className = classNames(
    styles.Badge,
    status && styles[variationName('status', status)],
    progress && styles[variationName('progress', progress)],
    size && size !== DEFAULT_SIZE && styles[variationName('size', size)],
  );

  let progressMarkup;
  switch (progress) {
    case PROGRESS_LABELS.incomplete:
      progressMarkup = intl.translate(
        'Polaris.Badge.PROGRESS_LABELS.incomplete',
      );
      break;
    case PROGRESS_LABELS.partiallyComplete:
      progressMarkup = intl.translate(
        'Polaris.Badge.PROGRESS_LABELS.partiallyComplete',
github Shopify / polaris-react / src / components / EmptyState / EmptyState.tsx View on Github external
render() {
    const {
      children,
      heading,
      image,
      largeImage,
      imageContained,
      action,
      secondaryAction,
      footerContent,
    } = this.props;

    const className = classNames(
      styles.EmptyState,
      imageContained &amp;&amp; styles.imageContained,
    );

    const imageMarkup = largeImage ? (
      <img sizes="(max-width: 568px) 60vw" role="presentation" alt="">
github Shopify / polaris-react / src / components / Tabs / components / Tab / Tab.tsx View on Github external
const {
      id,
      focused,
      siblingTabHasFocus,
      children,
      onClick,
      selected,
      url,
      panelID,
      measuring,
      accessibilityLabel,
    } = this.props;

    const handleClick = onClick &amp;&amp; onClick.bind(null, id);

    const className = classNames(
      styles.Tab,
      selected &amp;&amp; styles['Tab-selected'],
    );

    let tabIndex: 0 | -1;

    if (selected &amp;&amp; !siblingTabHasFocus &amp;&amp; !measuring) {
      tabIndex = 0;
    } else if (focused &amp;&amp; !measuring) {
      tabIndex = 0;
    } else {
      tabIndex = -1;
    }

    const markup = url ? (
github Shopify / polaris-react / src / components / DataTable / DataTable.tsx View on Github external
sortable,
      defaultSortDirection = 'ascending',
      initialSortColumnIndex = 0,
    } = this.props;

    const {
      collapsed,
      columnVisibilityData,
      heights,
      sortedColumnIndex = initialSortColumnIndex,
      sortDirection = defaultSortDirection,
      isScrolledFarthestLeft,
      isScrolledFarthestRight,
    } = this.state;

    const className = classNames(
      styles.DataTable,
      collapsed &amp;&amp; styles.collapsed,
      footerContent &amp;&amp; styles.hasFooter,
    );

    const wrapperClassName = classNames(
      styles.TableWrapper,
      collapsed &amp;&amp; styles.collapsed,
    );

    const footerClassName = classNames(footerContent &amp;&amp; styles.TableFoot);

    const footerMarkup = footerContent ? (
      
        {this.renderFooter()}

@shopify/css-utilities

A set of CSS styling-related utilities

MIT
Latest version published 2 years ago

Package Health Score

75 / 100
Full package analysis

Similar packages