feat: full studio build -- light theme, canvas thumbnails, i18n (fa/en)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
|
||||
import type { Layer, LayerProps } from "@/lib/studio-types";
|
||||
import { mergeLayerProps } from "@/lib/studio-layer-props";
|
||||
import { useStudioStore } from "@/lib/studio-store";
|
||||
|
||||
export function useLayerUpdater(layer: Layer) {
|
||||
const updateLayer = useStudioStore((state) => state.updateLayer);
|
||||
|
||||
const update = useCallback(
|
||||
(updates: Partial<Layer>) => {
|
||||
updateLayer(layer.id, updates);
|
||||
},
|
||||
[layer.id, updateLayer]
|
||||
);
|
||||
|
||||
const updateProps = useCallback(
|
||||
(updates: LayerProps) => {
|
||||
updateLayer(layer.id, {
|
||||
props: mergeLayerProps(layer.props, updates),
|
||||
});
|
||||
},
|
||||
[layer.id, layer.props, updateLayer]
|
||||
);
|
||||
|
||||
return { update, updateProps };
|
||||
}
|
||||
Reference in New Issue
Block a user