Skip to main content

Simple dock component for Pret

Project description

React-Simple-Dock

A set of React components to create a dockable interface, allowing to arrange and resize tabs.

Installation of the javascript package

npm install react-simple-dock

Installation of the PRET python package

pip install pret-simple-dock

Demo

Edit react-simple-dock

Usage

import React from "react";
import ReactDOM from "react-dom";
import { Layout, Panel } from "react-simple-dock";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";

const DEFAULT_CONFIG = {
    kind: "row",
    size: 100,
    children: [
        {
            kind: "column",
            size: 50,
            children: [
                { kind: "leaf", tabs: ["Panel 1"], tabIndex: 0, size: 50 },
                { kind: "leaf", tabs: ["Panel 2"], tabIndex: 0, size: 50 },
            ],
        },
        { kind: "leaf", tabs: ["Panel 3"], tabIndex: 0, size: 50 },
    ],
};

const App = () => (
    <div style={{ background: "#bdbdbd", width: "100vw", height: "100vh" }}>
        <Layout
            /* optional initial layout config */
            defaultConfig={DEFAULT_CONFIG}
        >
            <Panel key="Panel 1">
                <p>Content 1</p>
            </Panel>
            <Panel key="Panel 2" header={<i>Italic title</i>}>
                <p>Content 2</p>
            </Panel>
            <Panel key="Panel 3">
                <p>Content 3</p>
            </Panel>
        </Layout>
    </div>
);

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(<App />);

Development

Installation

Clone the repository:

git clone https://github.com/percevalw/react-simple-dock.git
cd react-simple-dock

Install the dependencies:

yarn install

Make your changes and run the demo:

yarn start

Build the javascript library

To build the javascript library:

yarn build:lib

Build the PRET python package

Ensure pret is installed.

pip install pret

If you have changed the signature of the components, you will need to update the python stubs.

pret stub . SimpleDock pret/ui/simple_dock/__init__.py

To build the python library and make it available in your environment:

pip install .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pret_simple_dock-0.2.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pret_simple_dock-0.2.0-py3-none-any.whl (45.0 kB view details)

Uploaded Python 3

File details

Details for the file pret_simple_dock-0.2.0.tar.gz.

File metadata

  • Download URL: pret_simple_dock-0.2.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for pret_simple_dock-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2f0e394bdafe12c209712bc61fcf7d72c78bc6d8dacbd9fcb49e60b1ffec33a8
MD5 3ca94f95eb8d12883b90b6aa6b582c2f
BLAKE2b-256 75b03aeb64fb38356c12bf8c452b497fad42b4fa528a39fd96a7598e6ff82d5c

See more details on using hashes here.

File details

Details for the file pret_simple_dock-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pret_simple_dock-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddfec25b8c5faff2c478182e1ae4275cbd771bbf031bb411c62c19640599e51c
MD5 84654d96638af0d0b5220ad27d71cbc6
BLAKE2b-256 57631d5c6b6e396a7200eb51d9bc1e02e0a96590a553972d3a9daccfb3bb1e45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page