@interopio/components-react
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

Overview

The @interopio/components-react library enables you to create your own Components App that will provide system apps for io.Connect Desktop (Channel Selector, dialogs, notifications and more). The library allows complete customization of the io.Connect Desktop system apps. The provided default components can be replaced or extended with your custom ones.

Customized Notification Panel for io.Connect Desktop with custom header, footer and custom text on the buttons for clearing notifications:

Custom Notification Panel

Contents

  • src/assets - contains common asset files;
  • src/components - contains default components for shared UI elements like buttons, forms, icons and more;
  • src/contexts - contains context provider components that are used across the io.Connect Desktop system apps;
  • src/features - contains the default components and hooks for all customizable io.Connect Desktop system apps;
  • src/hooks - contains hooks that are used across the io.Connect Desktop system apps;
  • src/utils - contains reusable functions that are used across the io.Connect Desktop system apps;

Prerequisites

For a io.Connect Desktop project, you must have io.Connect Desktop 9.0 or later.

Install

Components Library

To use the @interopio/components-react library in your project, execute the following command:

npm install @interopio/components-react

Storybook

Storybook is integrated into the project and the currently supported components are added to it. You can use it during development to test components and visualize states more easily.

To build Storybook:

npm run build-storybook

To run Storybook:

npm run storybook

Usage

The @interopio/components-react library provides default components and hooks which you can use to build your own Components App for io.Connect Desktop by using, modifying or replacing the available components and functionalities.

The following example demonstrates how to provide customized components for the Channel Selector and the dialogs apps of io.Connect Desktop:

import React, { Suspense, lazy } from "react";
import { RouterProvider, createHashRouter } from "react-router-dom";
import { IODialogs } from "@interopio/components-react";
// Using the default io.Connect themes.
import "@interopio/theme";
import "@interopio/components-react/dist/styles/variables.css";
import "@interopio/components-react/dist/styles/generic.css";

// Your custom Channel Selector.
const CustomChannelSelector = lazy(() =>
    import("./my-components/CustomChannelSelector")
);

// Your custom dialog component.
const CustomDialog = () => {
    const { DialogsProvider } = IODialogs;
    const Dialog = lazy(() => import("./my-components/CustomDialog"));

    return (
        <DialogsProvider>
            <Dialog />
        </DialogsProvider>
    );
};

const Loading = () => <div>Loading...</div>;

// Routes used by io.Connect Desktop for loading the system apps.
const routes = [
    {
        path: "channel-selector",
        element: <CustomChannelSelector />,
    },
    {
        path: "dialogs",
        element: <CustomDialog />,
    },
];

// By default, io.Connect Desktop loads its system apps from the file system.
// If your custom apps are hosted remotely, use `createBrowserRouter()` instead.
const router = createHashRouter(routes);

const App = () => {
    return (
        <Suspense fallback={<Loading />}>
            <RouterProvider router={router} />
        </Suspense>
    );
};

export default App;

To replace the default Components App of io.Connect Desktop, you must build your app and place it in the %LocalAppData%\interop.io\io.Connect Desktop\Desktop\assets\components folder.

Features

The @interopio/components-react library currently contains default components and hooks for the following io.Connect Desktop system apps:

License

MIT ©

Readme

Keywords

Package Sidebar

Install

npm i @interopio/components-react

Weekly Downloads

3

Version

0.1.3

License

MIT

Unpacked Size

2.67 MB

Total Files

441

Last publish

Collaborators

  • stbozov
  • thorsent
  • tsachev
  • smateev
  • ppetkow
  • flashd2n
  • gdavidkov
  • kiril.popov