diff --git a/src/taskpane/components/GridGuidelineManager.tsx b/src/taskpane/components/GridGuidelineManager.tsx index 42388383..137d61c0 100644 --- a/src/taskpane/components/GridGuidelineManager.tsx +++ b/src/taskpane/components/GridGuidelineManager.tsx @@ -1,27 +1,76 @@ +/** + * GridGuidelineManager Component + * + * This component provides functionality to create and manage grids and guidelines + * on PowerPoint slides. It allows users to add customizable grids with adjustable + * spacing, opacity, and color, as well as add individual guidelines with custom + * positioning and color. + * + * @module GridGuidelineManager + */ + import * as React from "react"; import { Button, makeStyles, Label, - Slider, - SpinButton, - Divider, ToggleButton, - tokens, - Input + tokens } from "@fluentui/react-components"; import { - GridRegular, DismissRegular, AddRegular, LineHorizontal3Regular, SplitVerticalRegular, - GridDotsRegular, - ArrowResetRegular + GridDotsRegular } from "@fluentui/react-icons"; import { useStatusContext } from "./App"; import { useCommonStyles } from "./commonStyles"; +/** + * Standard dimensions for PowerPoint slides in points + */ +const SLIDE_WIDTH = 960; // Width in points +const SLIDE_HEIGHT = 540; // Height in points + +/** + * Available colors for grids and guidelines + */ +type GridColor = "blue" | "red" | "yellow" | "green"; + +/** + * Direction options for guidelines + */ +type GuideDirection = "horizontal" | "vertical"; + +/** + * Prefixes used for naming shapes to identify them later + */ +const GRID_PREFIX = "edison_grid_"; +const GUIDE_PREFIX = "edison_guide_"; + +/** + * Color values mapping for the available grid and guideline colors + */ +const colorValues = { + blue: "#4472C4", + red: "#C00000", + yellow: "#FFC000", + green: "#70AD47" +}; + +/** + * Props for the ColorButton component + */ +interface ColorButtonProps { + /** The color this button represents */ + color: GridColor; + /** The currently selected color */ + selectedColor: GridColor; + /** Callback function when the color is clicked */ + onClick: (color: GridColor) => void; +} + const useStyles = makeStyles({ buttonGrid: { display: "grid", @@ -81,18 +130,55 @@ const useStyles = makeStyles({ } }); -type GridColor = "blue" | "red" | "yellow" | "green"; - -const GRID_PREFIX = "edison_grid_"; -const GUIDE_PREFIX = "edison_guide_"; - -const colorValues = { - blue: "#4472C4", - red: "#C00000", - yellow: "#FFC000", - green: "#70AD47" +/** + * ColorButton component - Renders a color selection button + * + * @param props - Component props + * @returns React component + */ +const ColorButton: React.FC = ({ color, selectedColor, onClick }) => { + const styles = useStyles(); + return ( +