Skip to content

Right Panel: Foldable comps sections #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: foldable components sections
  • Loading branch information
raheeliftikhar5 committed Nov 29, 2023
commit 436283f2ae2b2626390e576c5fa2d7919924115c
64 changes: 32 additions & 32 deletions client/packages/lowcoder/src/pages/editor/right/uiCompPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@ import { draggingUtils } from "layout";
import { isEmpty } from "lodash";
import { language } from "i18n";
import {
ComListTitle,
CompIconDiv,
EmptyCompContent,
RightPanelContentWrapper,
} from "pages/editor/right/styledComponent";
import { tableDragClassName } from "pages/tutorials/tutorialsConstant";
import React, { useContext, useMemo } from "react";
import styled from "styled-components";
import { labelCss } from "lowcoder-design";
import {
BaseSection,
labelCss,
} from "lowcoder-design";
import { TransparentImg } from "../../../util/commonUtils";
import { RightContext } from "./rightContext";

const GrayLabel = (props: { label: string }) => {
const { label } = props;
return <ComListTitle>{label}</ComListTitle>;
};

const CompDiv = styled.div`
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -80,12 +77,10 @@ const InsertContain = styled.div`
gap: 8px;
`;

const CategoryLabel = styled(GrayLabel)`
margin: 0;
`;

const SectionWrapper = styled.div`
margin-bottom: 16px;
.section-header {
margin-left: 0;
}
`;

export const UICompPanel = () => {
Expand Down Expand Up @@ -122,26 +117,31 @@ export const UICompPanel = () => {

return (
<SectionWrapper key={index}>
<CategoryLabel label={uiCompCategoryNames[key as UICompCategory]} />
<InsertContain>
{infos.map((info) => (
<CompDiv key={info[0]} className={info[0] === "table" ? tableDragClassName : ""}>
<HovDiv
draggable
onDragStart={(e) => {
e.dataTransfer.setData("compType", info[0]);
e.dataTransfer.setDragImage(TransparentImg, 0, 0);
draggingUtils.setData("compType", info[0]);
onDrag(info[0]);
}}
>
<IconContain Icon={info[1].icon}></IconContain>
</HovDiv>
<CompNameLabel>{info[1].name}</CompNameLabel>
{language !== "en" && <CompEnNameLabel>{info[1].enName}</CompEnNameLabel>}
</CompDiv>
))}
</InsertContain>
<BaseSection
noMargin
width={288}
name={uiCompCategoryNames[key as UICompCategory]}
>
<InsertContain>
{infos.map((info) => (
<CompDiv key={info[0]} className={info[0] === "table" ? tableDragClassName : ""}>
<HovDiv
draggable
onDragStart={(e) => {
e.dataTransfer.setData("compType", info[0]);
e.dataTransfer.setDragImage(TransparentImg, 0, 0);
draggingUtils.setData("compType", info[0]);
onDrag(info[0]);
}}
>
<IconContain Icon={info[1].icon}></IconContain>
</HovDiv>
<CompNameLabel>{info[1].name}</CompNameLabel>
{language !== "en" && <CompEnNameLabel>{info[1].enName}</CompEnNameLabel>}
</CompDiv>
))}
</InsertContain>
</BaseSection>
</SectionWrapper>
);
})
Expand Down