Make panels collapsible (#239)
* Make panels collapsible - Add Panel component with collapse logic - Use the component in all the necessary panel groups * Remove unnecessary container from PanelCanvas * Add "hide property" to Pane component to hide Panel contents using a prop - Instead of doing conditional rendering, pass the condition to Panel as props * Change collapse icon rotation for closed - Use one icon and use CSS transforms to rotate it * Remove unnecessary imports from PanelSelection
This commit is contained in:
committed by
Christopher Chedeau
parent
e38f65dea7
commit
36ce6a26e6
@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
|
||||
import { ColorPicker } from "../ColorPicker";
|
||||
import { Panel } from "../Panel";
|
||||
|
||||
interface PanelCanvasProps {
|
||||
viewBackgroundColor: string;
|
||||
@ -14,22 +15,19 @@ export const PanelCanvas: React.FC<PanelCanvasProps> = ({
|
||||
onClearCanvas
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<h4>Canvas</h4>
|
||||
<div className="panelColumn">
|
||||
<h5>Canvas Background Color</h5>
|
||||
<ColorPicker
|
||||
color={viewBackgroundColor}
|
||||
onChange={color => onViewBackgroundColorChange(color)}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClearCanvas}
|
||||
title="Clear the canvas & reset background color"
|
||||
>
|
||||
Clear canvas
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
<Panel title="Canvas">
|
||||
<h5>Canvas Background Color</h5>
|
||||
<ColorPicker
|
||||
color={viewBackgroundColor}
|
||||
onChange={color => onViewBackgroundColorChange(color)}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClearCanvas}
|
||||
title="Clear the canvas & reset background color"
|
||||
>
|
||||
Clear canvas
|
||||
</button>
|
||||
</Panel>
|
||||
);
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import { EditableText } from "../EditableText";
|
||||
import { Panel } from "../Panel";
|
||||
|
||||
interface PanelExportProps {
|
||||
projectName: string;
|
||||
@ -21,8 +22,7 @@ export const PanelExport: React.FC<PanelExportProps> = ({
|
||||
onExportAsPNG
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<h4>Export</h4>
|
||||
<Panel title="Export">
|
||||
<div className="panelColumn">
|
||||
<h5>Name</h5>
|
||||
{projectName && (
|
||||
@ -47,6 +47,6 @@ export const PanelExport: React.FC<PanelExportProps> = ({
|
||||
<button onClick={onSaveScene}>Save as...</button>
|
||||
<button onClick={onLoadScene}>Load file...</button>
|
||||
</div>
|
||||
</>
|
||||
</Panel>
|
||||
);
|
||||
};
|
||||
|
@ -14,8 +14,7 @@ export const PanelSelection: React.FC<PanelSelectionProps> = ({
|
||||
onSendToBack
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<h4>Selection</h4>
|
||||
<div>
|
||||
<div className="buttonList">
|
||||
<button type="button" onClick={onBringForward}>
|
||||
Bring forward
|
||||
@ -30,6 +29,6 @@ export const PanelSelection: React.FC<PanelSelectionProps> = ({
|
||||
Send to back
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -2,6 +2,7 @@ import React from "react";
|
||||
|
||||
import { SHAPES } from "../../shapes";
|
||||
import { capitalizeString } from "../../utils";
|
||||
import { Panel } from "../Panel";
|
||||
|
||||
interface PanelToolsProps {
|
||||
activeTool: string;
|
||||
@ -13,8 +14,7 @@ export const PanelTools: React.FC<PanelToolsProps> = ({
|
||||
onToolChange
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<h4>Shapes</h4>
|
||||
<Panel title="Shapes">
|
||||
<div className="panelTools">
|
||||
{SHAPES.map(({ value, icon }) => (
|
||||
<label
|
||||
@ -33,6 +33,6 @@ export const PanelTools: React.FC<PanelToolsProps> = ({
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
</Panel>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user