Elffuss BraidHub

kikocis/continue public

5aed8ce6ba7e · 1.5 KiBRawPermalink
1import styled from "styled-components";
2import {
3 defaultBorderRadius,
4 vscCommandCenterInactiveBorder,
5 vscInputBackground,
6} from "../..";
7import { useLump } from "./LumpContext";
8import { LumpToolbar } from "./LumpToolbar/LumpToolbar";
9import { SelectedSection } from "./sections/SelectedSection";
10
11const LumpDiv = styled.div`
12 background-color: ${vscInputBackground};
13 margin-left: 4px;
14 margin-right: 4px;
15 border-radius: ${defaultBorderRadius} ${defaultBorderRadius} 0 0;
16 border-top: 1px solid ${vscCommandCenterInactiveBorder};
17 border-left: 1px solid ${vscCommandCenterInactiveBorder};
18 border-right: 1px solid ${vscCommandCenterInactiveBorder};
19`;
20
21const ContentDiv = styled.div<{ hasSection: boolean; isVisible: boolean }>`
22 transition:
23 max-height 0.3s ease-in-out,
24 margin 0.3s ease-in-out,
25 opacity 0.2s ease-in-out;
26 max-height: ${(props) => (props.hasSection ? "200px" : "0px")};
27 margin: ${(props) => (props.hasSection ? "4px 0" : "0")};
28 opacity: ${(props) => (props.isVisible ? "1" : "0")};
29 overflow-y: auto;
30`;
31
32/**
33 * Internal component that consumes the LumpContext
34 */
35export function Lump() {
36 const { isLumpVisible, selectedSection } = useLump();
37
38 return (
39 <LumpDiv>
40 <div className="xs:px-2 px-1 py-0.5">
41 <LumpToolbar />
42
43 <ContentDiv
44 className="no-scrollbar pr-0.5"
45 hasSection={!!selectedSection}
46 isVisible={isLumpVisible}
47 >
48 <SelectedSection />
49 </ContentDiv>
50 </div>
51 </LumpDiv>
52 );
53}