How to use the bpk-react-utils.isRTL function in bpk-react-utils

To help you get started, we’ve selected a few bpk-react-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 Skyscanner / backpack / packages / bpk-component-calendar / src / BpkCalendarGridTransition.js View on Github external
componentWillReceiveProps(nextProps) {
    const hasMonthChanged = !isSameMonth(this.props.month, nextProps.month);

    if (hasMonthChanged) {
      const reverse = isRTL();

      if (differenceInCalendarMonths(nextProps.month, this.props.month) === 1) {
        // Transition to next month
        this.setState({
          transitionValue: reverse
            ? transitionValues.previous
            : transitionValues.next,
          isTransitioning: true,
        });
        return;
      }

      if (
        differenceInCalendarMonths(nextProps.month, this.props.month) === -1
      ) {
        // Transition to previous month
github Skyscanner / backpack / packages / bpk-component-navigation-stack / src / BpkNavigationStack.js View on Github external
const lastIndex = (views || []).length - 1;

    return (
      <div>
        
          {Children.map(views, (view, idx) =&gt; (
            
              </div>
github Skyscanner / backpack / packages / bpk-component-barchart / src / RTLtransforms.js View on Github external
const applyMarginRTLTransform = obj => {
  if (!isRTL()) {
    return obj;
  }
  const { left, right, ...rest } = obj;
  return {
    left: right,
    right: left,
    ...rest,
  };
};
github Skyscanner / backpack / packages / bpk-component-mobile-scroll-container / src / BpkMobileScrollContainer.js View on Github external
const computeScrollIndicatorClassName = (
  scrollerEl: ?HTMLElement,
  leadingIndicatorClassName: ?string = null,
  trailingIndicatorClassName: ?string = null,
) =&gt; {
  if (!scrollerEl) {
    return null;
  }

  const classNames = [];
  const { scrollLeft, scrollWidth, offsetWidth } = scrollerEl;

  const rtl = isRTL();
  const scrollValue = rtl ? -scrollLeft : scrollLeft;
  const showLeadingIndicator = scrollValue &gt; 0;
  const showTrailingIndicator = scrollValue &lt; scrollWidth - offsetWidth;
  const showLeftIndicator = rtl ? showTrailingIndicator : showLeadingIndicator;
  const showRightIndicator = rtl ? showLeadingIndicator : showTrailingIndicator;

  if (showLeftIndicator) {
    classNames.push(
      getClassName('bpk-mobile-scroll-container--left-indicator'),
    );
  }
  if (showRightIndicator) {
    classNames.push(
      getClassName('bpk-mobile-scroll-container--right-indicator'),
    );
  }
github Skyscanner / backpack / packages / bpk-component-slider / src / BpkSlider.js View on Github external
const BpkSlider = props => {
  const { large, className, ...rest } = props;
  const invert = isRTL();
  const classNames = [getClassName('bpk-slider')];
  const thumbClassNames = [getClassName('bpk-slider__handle')];
  const trackClassNames = [getClassName('bpk-slider__bar')];

  const isRange = (rest.value || rest.defaultValue || []).length > 1;

  if (isRange) {
    classNames.push(getClassName('bpk-slider--range'));
  }
  if (className) {
    classNames.push(getClassName(className));
  }
  if (large) {
    classNames.push(getClassName('bpk-slider--large'));
    thumbClassNames.push(getClassName('bpk-slider__handle--large'));
  }

bpk-react-utils

Utilities for Backpack's React components.

Apache-2.0
Latest version published 2 years ago

Package Health Score

73 / 100
Full package analysis

Similar packages