feat: integrate enhanced BlockLibrary component in SidePanel
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import './SidePanel.css';
|
import './SidePanel.css';
|
||||||
import LayerPanel from './LayerPanel';
|
import LayerPanel from './LayerPanel';
|
||||||
|
import BlockLibrary from './BlockLibrary';
|
||||||
|
|
||||||
const SidePanel: React.FC = () => {
|
const SidePanel: React.FC = () => {
|
||||||
const [activeTab, setActiveTab] = useState('blocks');
|
const [activeTab, setActiveTab] = useState('blocks');
|
||||||
@@ -8,6 +9,8 @@ const SidePanel: React.FC = () => {
|
|||||||
{ id: '1', name: 'Layer 1', visible: true, locked: false, color: '#000000', lineType: 'solid', transparency: 0, sortOrder: 0 }
|
{ id: '1', name: 'Layer 1', visible: true, locked: false, color: '#000000', lineType: 'solid', transparency: 0, sortOrder: 0 }
|
||||||
]);
|
]);
|
||||||
const [activeLayer, setActiveLayer] = useState('1');
|
const [activeLayer, setActiveLayer] = useState('1');
|
||||||
|
const canvasRef = useRef(null);
|
||||||
|
const yjsDocRef = useRef(null);
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{ id: 'blocks', label: 'Blocks', icon: '🧱' },
|
{ id: 'blocks', label: 'Blocks', icon: '🧱' },
|
||||||
@@ -37,7 +40,7 @@ const SidePanel: React.FC = () => {
|
|||||||
const renderContent = () => {
|
const renderContent = () => {
|
||||||
switch (activeTab) {
|
switch (activeTab) {
|
||||||
case 'blocks':
|
case 'blocks':
|
||||||
return <div className="panel-content">Blocks content goes here</div>;
|
return <BlockLibrary canvasRef={canvasRef} yjsDoc={yjsDocRef.current} />;
|
||||||
case 'layers':
|
case 'layers':
|
||||||
return (
|
return (
|
||||||
<LayerPanel
|
<LayerPanel
|
||||||
@@ -45,6 +48,7 @@ const SidePanel: React.FC = () => {
|
|||||||
setLayers={setLayers}
|
setLayers={setLayers}
|
||||||
activeLayer={activeLayer}
|
activeLayer={activeLayer}
|
||||||
setActiveLayer={setActiveLayer}
|
setActiveLayer={setActiveLayer}
|
||||||
|
yjsDoc={yjsDocRef.current}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'properties':
|
case 'properties':
|
||||||
|
|||||||
Reference in New Issue
Block a user