0.17.1 • Published 2 months ago

@bolttech/molecules-side-panel v0.17.1

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

Side Panel Component

The SidePanel component is a React component that provides a customizable side panel overlay for displaying additional content.

Installation

To use the SidePanel component, you need to install the required dependency:

npm install @bolttech/frontend-foundations @bolttech/molecules-side-panel

or

yarn add @bolttech/frontend-foundations @bolttech/molecules-side-panel

Usage

You can use the SidePanel component by importing it and including it in your JSX. Here's an example:

import React, {useState} from 'react';
import {SidePanel} from '@bolttech/molecules-side-panel';
import {bolttechTheme, BolttechThemeProvider} from "@bolttech/frontend-foundations"; // Adjust the path to your component

function App() {
  const [isSidePanelOpen, setIsSidePanelOpen] = useState(false);

  const openSidePanel = () => {
    setIsSidePanelOpen(true);
  };

  const closeSidePanel = () => {
    setIsSidePanelOpen(false);
  };

  return (
    <BolttechThemeProvider theme={bolttechTheme}>
      <button onClick={openSidePanel}>Open Side Panel</button>

      {/* Side Panel component */}
      <SidePanel
        isOpen={isSidePanelOpen}
        closeOnBackdropClick={true}
        onClose={closeSidePanel}
        dataTestId="side-panel"
        align="right"
      >
        {/* Content to display inside the side panel */}
        <h2>Side Panel Content</h2>
        <p>This is the content of the side panel.</p>
        <button onClick={closeSidePanel}>Close</button>
      </SidePanel>
    </BolttechThemeProvider>
  );
}

export default App;

Props

The SidePanel component accepts the following props:

PropTypeDescription
isOpenbooleanDetermines whether the side panel is open.
closeOnBackdropClickbooleanWhether the side panel should close on backdrop click.
alignstringAlignment of the side panel ("left" or "right").
onClosefunctionCallback function to close the side panel.
dataTestIdstringThe data-testid attribute for testing purposes.
childrenReactNodeContent to be displayed inside the side panel.

Functionality

The SidePanel component provides the following functionality:

  • Display: Renders a side panel with customizable content.
  • Opening and Closing: Opens and closes the side panel based on user interaction.
  • Backdrop Click: Closes the side panel when the backdrop is clicked (if enabled).

Contribution

Contributions to the SidePanel component are welcomed. If you encounter issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the component's Bitbucket repository.

0.17.1

2 months ago

0.0.1

4 months ago

0.11.0

9 months ago

0.10.1

10 months ago

0.13.0

9 months ago

0.14.0

9 months ago

0.15.0

8 months ago

0.16.0

6 months ago

0.15.1

8 months ago

0.17.0

6 months ago

0.16.1

6 months ago

0.10.0

10 months ago

0.3.0

10 months ago

0.9.0

10 months ago

0.2.6

10 months ago

0.9.1

10 months ago

0.5.0

10 months ago

0.4.0

10 months ago

0.7.0

10 months ago

0.2.3

11 months ago

0.2.2

11 months ago

0.2.5

11 months ago

0.2.4

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.0

12 months ago