Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Add effects section with opacity and cursor (#1760)

Ivan Starkov3178ddcc60e6
diff --git a/apps/builder/app/builder/features/style-panel/sections/effects/effects.tsx b/apps/builder/app/builder/features/style-panel/sections/effects/effects.tsx
new file mode 100644
index 0000000000..04ae822697
--- /dev/null
+++ b/apps/builder/app/builder/features/style-panel/sections/effects/effects.tsx
@@ -0,0 +1,58 @@
+import type { StyleProperty } from "@webstudio-is/css-data";
+import { Grid } from "@webstudio-is/design-system";
+import { styleConfigByName } from "../../shared/configs";
+import type { RenderCategoryProps } from "../../style-sections";
+import { PropertyName } from "../../shared/property-name";
+import { SelectControl, TextControl } from "../../controls";
+
+import { CollapsibleSection } from "../../shared/collapsible-section";
+import { theme } from "@webstudio-is/design-system";
+
+const properties: StyleProperty[] = ["cursor", "opacity"];
+
+export const EffectsSection = ({
+ currentStyle: style,
+ setProperty,
+ deleteProperty,
+}: RenderCategoryProps) => {
+ return (
+ <CollapsibleSection
+ label="Effects"
+ currentStyle={style}
+ properties={properties}
+ >
+ <Grid
+ gap={2}
+ css={{
+ gridTemplateColumns: `1fr ${theme.spacing[22]}`,
+ }}
+ >
+ <PropertyName
+ label={styleConfigByName("cursor").label}
+ property="cursor"
+ style={style}
+ onReset={() => deleteProperty("cursor")}
+ />
+ <SelectControl
+ property={"cursor"}
+ currentStyle={style}
+ setProperty={setProperty}
+ deleteProperty={deleteProperty}
+ />
+
+ <PropertyName
+ label={styleConfigByName("opacity").label}
+ property="opacity"
+ style={style}
+ onReset={() => deleteProperty("opacity")}
+ />
+ <TextControl
+ property={"opacity"}
+ currentStyle={style}
+ setProperty={setProperty}
+ deleteProperty={deleteProperty}
+ />
+ </Grid>
+ </CollapsibleSection>
+ );
+};
diff --git a/apps/builder/app/builder/features/style-panel/sections/index.ts b/apps/builder/app/builder/features/style-panel/sections/index.ts
index 64fffc8488..7f302a0580 100644
--- a/apps/builder/app/builder/features/style-panel/sections/index.ts
+++ b/apps/builder/app/builder/features/style-panel/sections/index.ts
@@ -8,3 +8,4 @@ export * from "./typography/typography";
export * from "./backgrounds/backgrounds";
export * from "./borders/borders";
export * from "./outline/outline";
+export * from "./effects/effects";
diff --git a/apps/builder/app/builder/features/style-panel/style-sections.tsx b/apps/builder/app/builder/features/style-panel/style-sections.tsx
index e431502ca8..428b6162f5 100644
--- a/apps/builder/app/builder/features/style-panel/style-sections.tsx
+++ b/apps/builder/app/builder/features/style-panel/style-sections.tsx
@@ -21,6 +21,7 @@ import {
BackgroundsSection,
BordersSection,
OutlineSection,
+ EffectsSection,
} from "./sections";
export const categories = [
@@ -34,6 +35,7 @@ export const categories = [
"backgrounds",
"borders",
"outline",
+ "effects",
];
export type Category = (typeof categories)[number];
@@ -140,4 +142,5 @@ export const sections: {
backgrounds: BackgroundsSection,
borders: BordersSection,
outline: OutlineSection,
+ effects: EffectsSection,
};