|
| 1 | +import React from "react" |
| 2 | +import Button from "react-bootstrap/Button" |
| 3 | +import { HiChevronDoubleLeft, HiChevronDoubleRight } from "react-icons/hi" |
| 4 | + |
| 5 | +export const CollpaseButton = ({ setCollapseSideBar, collapseSideBar }) => { |
| 6 | + |
| 7 | + const style = { |
| 8 | + userSelect: "none", |
| 9 | + zIndex: 99999, |
| 10 | + boxSizing: "border-box", |
| 11 | + appearance: "none", |
| 12 | + position: "absolute", |
| 13 | + display: "inline-flex", |
| 14 | + webkitBoxAlign: "center", |
| 15 | + alignItems: "center", |
| 16 | + textAlign: "center", |
| 17 | + verticalAlign: "middle", |
| 18 | + alignSelf: "center", |
| 19 | + textDecoration: "none", |
| 20 | + fontWeight: 500, |
| 21 | + /* margin: 0px; */ |
| 22 | + top: "50%", |
| 23 | + borderRadius: "9999px", |
| 24 | + webkitBoxPack: "center", |
| 25 | + justifyContent: "center", |
| 26 | + boxShadow:"rgba(0, 0, 0, 0.05) 0px 2px 4px", |
| 27 | + /* top: 80px; */ |
| 28 | + left: "19.5rem", |
| 29 | + fontSize: "12px", |
| 30 | + lineHeight: "16px", |
| 31 | + height: "24px", |
| 32 | + minWidth: "24px", |
| 33 | + color: "rgb(195 196 201)", |
| 34 | + backgroundColor: "rgb(100 100 100)", |
| 35 | + border: "1px solid rgb(208, 213, 231) !important", |
| 36 | + padding: "0px !important" |
| 37 | + } |
| 38 | + |
| 39 | + const hiddenStyle = { |
| 40 | + display: "block", |
| 41 | + zIndex: 99999, |
| 42 | + borderLeft: "1px solid #484848", |
| 43 | + borderRight: "1px solid #484848" |
| 44 | + } |
| 45 | + |
| 46 | + function handleCollapse() { |
| 47 | + setCollapseSideBar(!collapseSideBar) |
| 48 | + localStorage.setItem(`Terminusdb-SideBar-Collapsed`, !collapseSideBar) |
| 49 | + } |
| 50 | + |
| 51 | + return <Button //className="btn-btn-lg bg-transparent border border-0 ml-3" |
| 52 | + variant="dark" |
| 53 | + style={collapseSideBar ? hiddenStyle : style} |
| 54 | + title={collapseSideBar ? "Show Sidebar" : "Hide Sidebar" } |
| 55 | + onClick={handleCollapse}> |
| 56 | + {collapseSideBar && <HiChevronDoubleRight size={20}/>} |
| 57 | + {!collapseSideBar && <HiChevronDoubleLeft size={20}/>} |
| 58 | + </Button> |
| 59 | +} |
0 commit comments