How to use @airbnb/lunar - 10 common examples

To help you get started, we’ve selected a few @airbnb/lunar 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 airbnb / lunar / packages / apollo / src / components / Mutation / index.tsx View on Github external
private handleRender = (mutator: MutationFunction, result: MutationResult<data>) =&gt; {
    if (result.loading) {
      return renderElementOrFunction(this.props.loading) || ;
    }

    if (result.error &amp;&amp; (!this.props.ignoreGraphQLErrors || result.error.networkError)) {
      // istanbul ignore next (need to fix tests)
      return (
        renderElementOrFunction(this.props.error, result.error) || (
          
        )
      );
    }

    return this.props.children(mutator, result);
  };
</data>
github airbnb / lunar / packages / apollo / src / components / Mutation / index.tsx View on Github external
private handleRender = (mutator: MutationFunction, result: MutationResult<data>) =&gt; {
    if (result.loading) {
      return renderElementOrFunction(this.props.loading) || ;
    }

    if (result.error &amp;&amp; (!this.props.ignoreGraphQLErrors || result.error.networkError)) {
      // istanbul ignore next (need to fix tests)
      return (
        renderElementOrFunction(this.props.error, result.error) || (
          
        )
      );
    }

    return this.props.children(mutator, result);
  };
</data>
github airbnb / lunar / packages / apollo / src / index.ts View on Github external
bootstrapClient() {
    if (this.client) {
      return;
    }

    const { links, resolvers, typeDefs } = this.settings;

    this.client = new ApolloClient({
      cache: new InMemoryCache(),
      connectToDevTools: __DEV__,
      link: ApolloLink.from(links),
      name: Core.settings.name,
      resolvers,
      typeDefs,
      version: pkg.version,
    });

    if (__DEV__) {
      // eslint-disable-next-line no-underscore-dangle
      window.__APOLLO_CLIENT__ = this.client;
    }
  }
github airbnb / lunar / packages / app-shell / src / composers / connectToApp.tsx View on Github external
render() {
        const { app, ...props } = this.props;

        // @ts-ignore Props spreading
        return ;
      }
    }

    function ConnectToAppWrapper(props: Props) {
      return (
        {app =&gt; }
      );
    }

    return withBoundary(scope)(finishHOC('connectToApp', ConnectToAppWrapper, WrappedComponent));
  };
}
github apache-superset / superset-ui-plugins / packages / superset-ui-plugin-chart-table / src / getRenderer.tsx View on Github external
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable no-magic-numbers */
import React, { CSSProperties, useMemo } from 'react';
import { HEIGHT_TO_PX } from '@airbnb/lunar/lib/components/DataTable/constants';
import { RendererProps } from '@airbnb/lunar/lib/components/DataTable/types';
import { NumberFormatter } from '@superset-ui/number-format';
import { TimeFormatter } from '@superset-ui/time-format';
import HTMLRenderer from './components/HTMLRenderer';

const NEGATIVE_COLOR = '#FFA8A8';
const POSITIVE_COLOR = '#ced4da';
const SELECTION_COLOR = '#EBEBEB';

const NOOP = () => {};

const HEIGHT = HEIGHT_TO_PX.micro;

export type ColumnType = {
  key: string;
  label: string;
  format?: NumberFormatter | TimeFormatter | undefined;
  type: 'metric' | 'string';
  maxValue?: number;
  minValue?: number;
};

export type Cell = {
  key: string;
  value: any;
};

const NUMBER_STYLE: CSSProperties = {
github airbnb / lunar / .storybook / bootstrap.js View on Github external
import 'airbnb-js-shims';
import { stripHexcode } from 'emojibase';
import Lunar from '@airbnb/lunar';
import { THEME } from './constants';

Lunar.initialize({
  name: 'Lunar',
  emojiCDN: (hexcode, large) =>
    `https://cdn.jsdelivr.net/emojione/assets/4.5/png/${large ? 64 : 32}/${stripHexcode(
      hexcode,
    ).toLowerCase()}.png`,
  logger: console.log,
  theme: THEME,
});
github airbnb / lunar / guide / setup.js View on Github external
import Lunar from '@airbnb/lunar';
import moon from './images/moon.jpg';
import stars from './images/stars.jpg';
import lunar from './images/lunar.png';

global.log = (...args) => console.log(...args);
global.debug = key => (...args) => console.log(key, ...args);
global.images = { moon, stars, lunar };

Lunar.initialize({
  emojiCDN: hexcode =>
    `https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/assets/png/${hexcode.toLowerCase()}.png`,
  logger: global.log,
});
github airbnb / lunar / packages / layouts / src / components / LayoutShell / index.tsx View on Github external
export default function LayoutShell({ children, sideBar }: Props) {
  const [styles, cx] = useStyles(styleSheet);

  return (
    <div>
      {sideBar &amp;&amp; <aside>{sideBar}</aside>}

      <div>{children}</div>
    </div>
  );
}
github airbnb / lunar / packages / layouts / src / components / SideBar / index.tsx View on Github external
export default function SideBar({ accessibilityLabel, children }: Props) {
  const [styles, cx] = useStyles(styleSheet);

  return (
    <nav>
      <ul aria-label="{accessibilityLabel}" role="menubar">
        {children}
      </ul>
    </nav>
  );
}
github airbnb / lunar / packages / layouts / src / components / Layout / index.tsx View on Github external
export default function Layout({
  after,
  before,
  centerAlign,
  children,
  fluid,
  minHeight,
  noBackground,
  noPadding,
}: Props &amp; AsideProps) {
  const [styles, cx] = useStyles(styleSheet);

  return (
    <div>
      {before}

      <main role="main">
        </main></div>