mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Extract Sidebar panels into separate components (#230)
* Extract Sidebar panels into separate components * Add Jest TS types
This commit is contained in:
parent
2fb5c4cd13
commit
85365e5bcb
8 changed files with 246 additions and 101 deletions
52
src/components/panels/PanelExport.tsx
Normal file
52
src/components/panels/PanelExport.tsx
Normal file
|
@ -0,0 +1,52 @@
|
|||
import React from "react";
|
||||
import { EditableText } from "../EditableText";
|
||||
|
||||
interface PanelExportProps {
|
||||
projectName: string;
|
||||
onProjectNameChange: (name: string) => void;
|
||||
onExportAsPNG: React.MouseEventHandler;
|
||||
exportBackground: boolean;
|
||||
onExportBackgroundChange: (val: boolean) => void;
|
||||
onSaveScene: React.MouseEventHandler;
|
||||
onLoadScene: React.MouseEventHandler;
|
||||
}
|
||||
|
||||
export const PanelExport: React.FC<PanelExportProps> = ({
|
||||
projectName,
|
||||
exportBackground,
|
||||
onProjectNameChange,
|
||||
onExportBackgroundChange,
|
||||
onSaveScene,
|
||||
onLoadScene,
|
||||
onExportAsPNG
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<h4>Export</h4>
|
||||
<div className="panelColumn">
|
||||
<h5>Name</h5>
|
||||
{projectName && (
|
||||
<EditableText
|
||||
value={projectName}
|
||||
onChange={(name: string) => onProjectNameChange(name)}
|
||||
/>
|
||||
)}
|
||||
<h5>Image</h5>
|
||||
<button onClick={onExportAsPNG}>Export to png</button>
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={exportBackground}
|
||||
onChange={e => {
|
||||
onExportBackgroundChange(e.target.checked);
|
||||
}}
|
||||
/>
|
||||
background
|
||||
</label>
|
||||
<h5>Scene</h5>
|
||||
<button onClick={onSaveScene}>Save as...</button>
|
||||
<button onClick={onLoadScene}>Load file...</button>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue