How to use the piral-core.getExtensionSlot function in piral-core

To help you get started, we’ve selected a few piral-core 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 smapiot / piral / packages / piral / src / components / ErrorInfo.tsx View on Github external
import * as React from 'react';
import { getExtensionSlot, ErrorInfoProps } from 'piral-core';
import {
  NotFoundErrorInfo,
  PageErrorInfo,
  LoadingErrorInfo,
  FeedErrorInfo,
  FormErrorInfo,
  UnknownErrorInfo,
} from './errors';

const ExtensionSlot = getExtensionSlot('error');

function getErrorInfo(props: ErrorInfoProps) {
  switch (props.type) {
    case 'not_found':
      return ;
    case 'page':
      return ;
    case 'loading':
      return ;
    case 'feed':
      return ;
    case 'form':
      return ;
    default:
      return ;
  }
github smapiot / piral / src / packages / piral / src / components / Dashboard.tsx View on Github external
import * as React from 'react';
import { getExtensionSlot, useGlobalState } from 'piral-core';
import { DashboardProps } from 'piral-ext';
import { DashboardContainerProps, TileProps } from '../types';

const ExtensionSlot = getExtensionSlot('dashboard');

export interface DashboardCreator {
  DashboardContainer: React.ComponentType;
  Tile: React.ComponentType;
}

export function createDashboard({ DashboardContainer, Tile }: DashboardCreator): React.FC {
  return props => {
    const tiles = useGlobalState(s => s.components.tiles);

    return (
      <>
        
          {Object.keys(tiles).map(tile => {
            const {
              component: Component,