Skip to content

Commit

Permalink
Added compressedPanes and decompressPanes methods to the paneManager
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio-goncalves-unp committed Apr 14, 2023
1 parent 08ab90a commit d088ba8
Show file tree
Hide file tree
Showing 5 changed files with 3,165 additions and 2,192 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,17 @@ Wrapper component which will provide the "paneManagerControls" object containing

Object containing several methods to control the behaviour of the Pane manager

| Name | Type | Description |
| ----------- | ----------- | --- |
| addPane | (pane:Pane)=>void | Used to add a new pane |
| closeLastPane | ()=>void | Close the last pane |
| closePane | (index: number)=>void | Close a specific pane |
| setSidePane | (sidePane: SidePane)=>void | Add a side pane to the last pane |
| closeSidePane | ()=>void | Close side pane |
| Name | Type | Description |
| ----------- | -------- |-----------------------------------------------------------------------|
| addPane | (pane:Pane)=>void | Used to add a new pane |
| closeLastPane | ()=>void | Close the last pane |
| closePane | (index: number)=>void | Close a specific pane |
| setSidePane | (sidePane: SidePane)=>void | Add a side pane to the last pane |
| closeSidePane | ()=>void | Close side pane |
| updateLastPaneProps | (props:object)=>void | Update props sent to the last pane, this update will re fire a render of the pane content |
| updateSidePaneProps | (props:object)=>void | Update props sent to the side pane, this update will re fire a render of the side pane content |
| compressPanes | ()=>void | Forces all panes to collapses until the meet the "minPaneDistance" regarding its distance |
| decompressPanes | ()=>void | Set panes distance to their default distance |

### Pane

Expand Down
11 changes: 8 additions & 3 deletions dev/main.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect} from "react";
import React, {useEffect, useState} from "react";

import './main.css'
import "../src/main.scss"
Expand Down Expand Up @@ -33,7 +33,7 @@ function SideContent({paneManagerControls, title,n}:SideContentProps){
}

function Content({title,paneManagerControls,n}:ContentProps){
const {setSidePane, closeSidePane,addPane,closeLastPane} = paneManagerControls
const {setSidePane, closeSidePane,addPane,closeLastPane,compressPanes,decompressPanes} = paneManagerControls

function setSidePaneBtn(){
setSidePane({
Expand Down Expand Up @@ -74,15 +74,19 @@ function Content({title,paneManagerControls,n}:ContentProps){
<button onClick={()=>{setSidePaneBtn()}}>Set side pane</button>
<button onClick={()=>{openNewPane()}}>Open new pane</button>
<button onClick={()=>{openNewPaneAsFullscreen()}}>Open new pane as fullscreen</button>
<button onClick={()=>{compressPanes()}}>Compress panes</button>
<button onClick={()=>{decompressPanes()}}>Decompress panes</button>

</div>

)
}

export const Main = function(){


const pane:Pane = {
content:((paneManagerControls) =><Content title={"First Pane"} paneManagerControls={paneManagerControls}/> ),
content:((paneManagerControls) =><Content title={"First pane"} paneManagerControls={paneManagerControls} />),
shouldClose:()=>confirm("Should close pane?"),
onClose:()=>{console.log("Closed root pane")},
willClose:()=>{console.log("Root pane will")}
Expand All @@ -109,6 +113,7 @@ export const Main = function(){
{(paneManagerControls)=>(
<div>
<h1>Root Content</h1>

<button onClick={()=>{paneManagerControls.addPane(pane)}}>Add first pane</button>
</div>
)}
Expand Down
Loading

0 comments on commit d088ba8

Please sign in to comment.