Configure the settings panel
Let's set up the right panel configuration and inject selected values into the component.
The result will look like this:
Create a padding preset
Define which elements and features to include in the component's right panel configuration. Begin by setting up a padding preset. This is where you decide which elements can be customized, including the visibility of an image, and selection of colors, fonts, or padding.
src/util/padding/padding.preset.ts
import { numeric, object } from "@zoovu/theme-editor-parameter-types";
export const paddingPreset = object(
{
horizontal: numeric({
default: { value: 10, unit: "px" },
label: "Horizontal",
units: [ "px", "%", "rem", "em" ],
}),
vertical: numeric({
default: { value: 10, unit: "px" },
label: "Vertical",
units: [ "px", "%", "rem", "em" ],
}),
},
{ label: "Padding", addSeparator: true }
)
Create padding configuration
Next, make sure the actual configuration matches your initial preset exactly.
The values from the preset will be injected into the PaddingConfiguration
object
and then used within the Vue component.
src/util/padding/padding.configuration.ts
import { NumericValue } from "@zoovu/theme-editor-parameter-types";
export class PaddingConfiguration {
horizontal: NumericValue = { value: 10, unit: "px" };
vertical: NumericValue = { value: 10, unit: "px" };
}