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.

feat: Add support for `text-shadow` property in style-panel (#3318)

Jaya Krishna Namburuce1f9026cdf7
diff --git a/apps/builder/app/builder/features/style-panel/sections/backdrop-filter/backdrop-filter.tsx b/apps/builder/app/builder/features/style-panel/sections/backdrop-filter/backdrop-filter.tsx
index 17226abed7..6bf2084128 100644
--- a/apps/builder/app/builder/features/style-panel/sections/backdrop-filter/backdrop-filter.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/backdrop-filter/backdrop-filter.tsx
@@ -91,14 +91,19 @@ export const Section = (props: SectionProps) => {
label={label}
tooltip={
<Tooltip
- css={{ width: "208px" }}
+ variant="wrapped"
content={
<Flex gap="2" direction="column">
<Text variant="regularBold">{label}</Text>
<Text variant="monoBold">backdrop-filter</Text>
<Text>
Applies graphical effects like blur or color shift to
- the area behind an element
+ the area behind an element, for example:
+ <br />
+ <br />
+ <Text variant="monoBold">
+ {INITIAL_BACKDROP_FILTER}
+ </Text>
</Text>
</Flex>
}
diff --git a/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadows.tsx b/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadows.tsx
index 6283cb31d6..ce7456dde8 100644
--- a/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadows.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadows.tsx
@@ -2,8 +2,10 @@ import {
SectionTitle,
SectionTitleButton,
SectionTitleLabel,
+ Tooltip,
+ Text,
} from "@webstudio-is/design-system";
-import { PlusIcon } from "@webstudio-is/icons";
+import { InfoCircleIcon, PlusIcon } from "@webstudio-is/icons";
import type {
LayersValue,
StyleProperty,
@@ -16,9 +18,9 @@ import { PropertyName } from "../../shared/property-name";
import { getStyleSource } from "../../shared/style-info";
import type { SectionProps } from "../shared/section";
import { LayersList } from "../../style-layers-list";
-import { BoxShadowLayer } from "./box-shadow-layer";
import { addLayer } from "../../style-layer-utils";
import { parseShadow } from "@webstudio-is/css-data";
+import { ShadowLayer } from "../../shared/shadow-layer";
export const properties = ["boxShadow"] satisfies Array<StyleProperty>;
@@ -60,7 +62,7 @@ export const Section = (props: SectionProps) => {
}
>
<PropertyName
- title="Box Shadows"
+ title={label}
style={currentStyle}
properties={properties}
description="Adds shadow effects around an element's frame."
@@ -79,9 +81,31 @@ export const Section = (props: SectionProps) => {
property={property}
layers={value}
{...props}
- renderLayer={(layersProps) => (
- <BoxShadowLayer key={layersProps.index} {...layersProps} />
- )}
+ renderLayer={(layersProps) => {
+ return (
+ <ShadowLayer
+ key={layersProps.index}
+ {...layersProps}
+ label={label}
+ tooltip={
+ <Tooltip
+ variant="wrapped"
+ content={
+ <Text>
+ Paste a box-shadow CSS code without the property name,
+ for example:
+ <br />
+ <br />
+ <Text variant="monoBold">{INITIAL_BOX_SHADOW}</Text>
+ </Text>
+ }
+ >
+ <InfoCircleIcon />
+ </Tooltip>
+ }
+ />
+ );
+ }}
/>
)}
</CollapsibleSectionRoot>
diff --git a/apps/builder/app/builder/features/style-panel/sections/filter/filter-content.tsx b/apps/builder/app/builder/features/style-panel/sections/filter/filter-content.tsx
index 6ce4df8a61..42e683decd 100644
--- a/apps/builder/app/builder/features/style-panel/sections/filter/filter-content.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/filter/filter-content.tsx
@@ -1,6 +1,7 @@
import type {
InvalidValue,
LayersValue,
+ StyleProperty,
TupleValue,
} from "@webstudio-is/css-engine";
import {
@@ -18,6 +19,7 @@ import type { DeleteProperty } from "../../shared/use-style-data";
type FilterContentProps = {
index: number;
filter: string;
+ property: StyleProperty;
onEditLayer: (index: number, layers: LayersValue | TupleValue) => void;
deleteProperty: DeleteProperty;
tooltip: JSX.Element;
@@ -26,6 +28,7 @@ type FilterContentProps = {
export const FilterSectionContent = ({
index,
filter,
+ property,
onEditLayer,
deleteProperty,
tooltip,
@@ -101,7 +104,7 @@ export const FilterSectionContent = ({
return;
}
- deleteProperty("filter", { isEphemeral: true });
+ deleteProperty(property, { isEphemeral: true });
setIntermediateValue(undefined);
event.preventDefault();
}
diff --git a/apps/builder/app/builder/features/style-panel/sections/filter/filter-layer.tsx b/apps/builder/app/builder/features/style-panel/sections/filter/filter-layer.tsx
index cab1e36dd9..2601398bab 100644
--- a/apps/builder/app/builder/features/style-panel/sections/filter/filter-layer.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/filter/filter-layer.tsx
@@ -19,6 +19,7 @@ export const FilterLayer = <T extends FunctionValue>(props: LayerProps<T>) => {
title={label}
content={
<FilterSectionContent
+ property={props.property}
index={index}
filter={filter}
onEditLayer={props.onEditLayer}
diff --git a/apps/builder/app/builder/features/style-panel/sections/filter/filter.tsx b/apps/builder/app/builder/features/style-panel/sections/filter/filter.tsx
index 36f75c9eae..97a4dd233b 100644
--- a/apps/builder/app/builder/features/style-panel/sections/filter/filter.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/filter/filter.tsx
@@ -91,14 +91,17 @@ export const Section = (props: SectionProps) => {
label={label}
tooltip={
<Tooltip
- css={{ width: "208px" }}
+ variant="wrapped"
content={
<Flex gap="2" direction="column">
<Text variant="regularBold">{label}</Text>
<Text variant="monoBold">filter</Text>
<Text>
Applies graphical effects like blur or color shift to an
- element
+ element, for example:
+ <br />
+ <br />
+ <Text variant="monoBold">{INITIAL_FILTER}</Text>
</Text>
</Flex>
}
diff --git a/apps/builder/app/builder/features/style-panel/sections/sections.ts b/apps/builder/app/builder/features/style-panel/sections/sections.ts
index e6a6d657a4..04b1dfbc5e 100644
--- a/apps/builder/app/builder/features/style-panel/sections/sections.ts
+++ b/apps/builder/app/builder/features/style-panel/sections/sections.ts
@@ -13,6 +13,7 @@ import * as filter from "./filter/filter";
import * as transitions from "./transitions/transitions";
import * as outline from "./outline/outline";
import * as advanced from "./advanced/advanced";
+import * as textShadows from "./text-shadows/text-shadows";
import * as backdropFilter from "./backdrop-filter/backdrop-filter";
import type { StyleProperty } from "@webstudio-is/css-engine";
import type { SectionProps } from "./shared/section";
@@ -31,6 +32,7 @@ export const sections = new Map<
["size", size],
["position", position],
["typography", typography],
+ ["textShadows", textShadows],
["backgrounds", backgrounds],
["borders", borders],
["boxShadows", boxShadows],
diff --git a/apps/builder/app/builder/features/style-panel/sections/text-shadows/text-shadows.tsx b/apps/builder/app/builder/features/style-panel/sections/text-shadows/text-shadows.tsx
new file mode 100644
index 0000000000..80868f201c
--- /dev/null
+++ b/apps/builder/app/builder/features/style-panel/sections/text-shadows/text-shadows.tsx
@@ -0,0 +1,111 @@
+import { CollapsibleSectionRoot } from "~/builder/shared/collapsible-section";
+import type { SectionProps } from "../shared/section";
+import type {
+ LayersValue,
+ StyleProperty,
+ TupleValue,
+} from "@webstudio-is/css-engine";
+import { useState } from "react";
+import {
+ SectionTitle,
+ SectionTitleButton,
+ SectionTitleLabel,
+ Tooltip,
+ Text,
+} from "@webstudio-is/design-system";
+import { InfoCircleIcon, PlusIcon } from "@webstudio-is/icons";
+import { addLayer } from "../../style-layer-utils";
+import { parseShadow } from "@webstudio-is/css-data";
+import { getDots } from "../../shared/collapsible-section";
+import { PropertyName } from "../../shared/property-name";
+import { getStyleSource } from "../../shared/style-info";
+import { LayersList } from "../../style-layers-list";
+import { ShadowLayer } from "../../shared/shadow-layer";
+
+export const properties = ["textShadow"] satisfies Array<StyleProperty>;
+
+const property: StyleProperty = properties[0];
+const label = "Text Shadows";
+const INITIAL_TEXT_SHADOW = "0px 2px 5px rgba(0, 0, 0, 0.2)";
+
+export const Section = (props: SectionProps) => {
+ const { currentStyle, createBatchUpdate, deleteProperty } = props;
+ const [isOpen, setIsOpen] = useState(false);
+ const value = currentStyle[property]?.value;
+ const sectionStyleSource =
+ value?.type === "unparsed" || value?.type === "guaranteedInvalid"
+ ? undefined
+ : getStyleSource(currentStyle[property]);
+
+ return (
+ <CollapsibleSectionRoot
+ fullWidth
+ label={label}
+ isOpen={isOpen}
+ onOpenChange={setIsOpen}
+ trigger={
+ <SectionTitle
+ dots={getDots(currentStyle, properties)}
+ suffix={
+ <SectionTitleButton
+ prefix={<PlusIcon />}
+ onClick={() => {
+ addLayer(
+ property,
+ parseShadow("textShadow", INITIAL_TEXT_SHADOW),
+ currentStyle,
+ createBatchUpdate
+ );
+ setIsOpen(true);
+ }}
+ />
+ }
+ >
+ <PropertyName
+ title={label}
+ style={currentStyle}
+ properties={properties}
+ description="Adds shadow effects around a text."
+ label={
+ <SectionTitleLabel color={sectionStyleSource}>
+ {label}
+ </SectionTitleLabel>
+ }
+ onReset={() => deleteProperty(property)}
+ />
+ </SectionTitle>
+ }
+ >
+ {value?.type === "layers" && value.value.length > 0 && (
+ <LayersList<TupleValue, LayersValue>
+ property={property}
+ layers={value}
+ {...props}
+ renderLayer={(layersProps) => (
+ <ShadowLayer
+ {...layersProps}
+ key={layersProps.index}
+ label={label}
+ tooltip={
+ <Tooltip
+ variant="wrapped"
+ content={
+ <Text>
+ Paste a text-shadow CSS code without the property name,
+ for example:
+ <br />
+ <br />
+ <Text variant="monoBold">{INITIAL_TEXT_SHADOW}</Text>
+ </Text>
+ }
+ >
+ <InfoCircleIcon />
+ </Tooltip>
+ }
+ />
+ )}
+ />
+ )}
+ </CollapsibleSectionRoot>
+ );
+};
diff --git a/apps/builder/app/builder/features/style-panel/sections/transitions/transition-content.tsx b/apps/builder/app/builder/features/style-panel/sections/transitions/transition-content.tsx
index b75f6a43b4..cc6074b8ac 100644
--- a/apps/builder/app/builder/features/style-panel/sections/transitions/transition-content.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/transitions/transition-content.tsx
@@ -123,6 +123,7 @@ export const TransitionContent = ({
<Flex align="center">
<Tooltip
+ variant="wrapped"
content={
<Flex gap="2" direction="column">
<Text variant="regularBold">Duration</Text>
@@ -130,10 +131,8 @@ export const TransitionContent = ({
transition-duration
</Text>
<Text>
- Sets the length of time a
- <br />
- transition animation should take
- <br /> to complete.
+ Sets the length of time a transition animation should take to
+ complete.
</Text>
</Flex>
}
@@ -161,6 +160,7 @@ export const TransitionContent = ({
<Flex align="center">
<Tooltip
+ variant="wrapped"
content={
<Flex gap="2" direction="column">
<Text variant="regularBold">Delay</Text>
@@ -168,9 +168,7 @@ export const TransitionContent = ({
transition-delay
</Text>
<Text>
- Specify the duration to wait
- <br />
- before the transition begins.
+ Specify the duration to wait before the transition begins.
</Text>
</Flex>
}
@@ -218,14 +216,11 @@ export const TransitionContent = ({
variant="wrapped"
content={
<Text>
- Paste CSS code for a transition
- <br />
- or part of a transition, for
- <br />
+ Paste CSS code for a transition or part of a transition, for
example:
<br />
<br />
- opacity 200ms ease;
+ <Text variant="monoBold">opacity 200ms ease</Text>
</Text>
}
>
diff --git a/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-content.tsx b/apps/builder/app/builder/features/style-panel/shared/shadow-content.tsx
similarity index 70%
rename from apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-content.tsx
rename to apps/builder/app/builder/features/style-panel/shared/shadow-content.tsx
index 5af08575e2..0794d9187c 100644
--- a/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-content.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/shadow-content.tsx
@@ -3,6 +3,7 @@ import {
type InvalidValue,
type LayersValue,
type RgbValue,
+ type StyleProperty,
type StyleValue,
type TupleValue,
type UnitValue,
@@ -25,17 +26,13 @@ import {
ToggleGroupButton,
Tooltip,
} from "@webstudio-is/design-system";
-import {
- InfoCircleIcon,
- ShadowInsetIcon,
- ShadowNormalIcon,
-} from "@webstudio-is/icons";
+import { ShadowInsetIcon, ShadowNormalIcon } from "@webstudio-is/icons";
import { useMemo, useState } from "react";
-import type { IntermediateStyleValue } from "../../shared/css-value-input";
-import { CssValueInputContainer } from "../../shared/css-value-input";
-import { toPascalCase } from "../../shared/keyword-utils";
-import { ColorControl } from "../../controls";
-import type { DeleteProperty, SetProperty } from "../../shared/use-style-data";
+import type { IntermediateStyleValue } from "../shared/css-value-input";
+import { CssValueInputContainer } from "../shared/css-value-input";
+import { toPascalCase } from "../shared/keyword-utils";
+import { ColorControl } from "../controls";
+import type { DeleteProperty, SetProperty } from "../shared/use-style-data";
/*
When it comes to checking and validating individual CSS properties for the box-shadow,
@@ -61,10 +58,12 @@ import type { DeleteProperty, SetProperty } from "../../shared/use-style-data";
https://www.w3.org/TR/css-backgrounds-3/#propdef-border-top-width
*/
-type BoxShadowContentProps = {
+type ShadowContentProps = {
index: number;
layer: TupleValue;
+ property: StyleProperty;
shadow: string;
+ tooltip: JSX.Element;
onEditLayer: (index: number, layers: LayersValue) => void;
deleteProperty: DeleteProperty;
};
@@ -86,13 +85,15 @@ const boxShadowInsetValues = [
{ value: "inset", Icon: ShadowInsetIcon },
] as const;
-export const BoxShadowContent = ({
+export const ShadowContent = ({
layer,
index,
+ property,
+ tooltip,
shadow,
onEditLayer,
deleteProperty,
-}: BoxShadowContentProps) => {
+}: ShadowContentProps) => {
const [intermediateValue, setIntermediateValue] = useState<
IntermediateStyleValue | InvalidValue | undefined
>();
@@ -161,16 +162,14 @@ export const BoxShadowContent = ({
>
<Flex direction="column">
<Tooltip
+ variant="wrapped"
content={
<Flex gap="2" direction="column">
<Text variant="regularBold">X Offset</Text>
<Text variant="monoBold">offset-x</Text>
<Text>
- Sets the horizontal offset of the
- <br />
- shadow. Negative values place
- <br />
- the shadow to the left.
+ Sets the horizontal offset of the shadow. Negative values
+ place the shadow to the left.
</Text>
</Flex>
}
@@ -197,16 +196,14 @@ export const BoxShadowContent = ({
<Flex direction="column">
<Tooltip
+ variant="wrapped"
content={
<Flex gap="2" direction="column">
<Text variant="regularBold">Blur Radius</Text>
<Text variant="monoBold">blur-radius</Text>
<Text>
- The larger this value, the bigger
- <br />
- the blur, so the shadow becomes
- <br />
- bigger and lighter.
+ The larger this value, the bigger the blur, so the shadow
+ becomes bigger and lighter.
</Text>
</Flex>
}
@@ -233,15 +230,13 @@ export const BoxShadowContent = ({
<Flex direction="column">
<Tooltip
+ variant="wrapped"
content={
<Flex gap="2" direction="column">
<Text variant="regularBold">Y Offset</Text>
<Text variant="monoBold">offset-y</Text>
<Text>
- Sets the vertical offset of the
- <br />
- shadow. Negative values place
- <br />
+ Sets the vertical offset of the shadow. Negative values place
the shadow above.
</Text>
</Flex>
@@ -267,43 +262,41 @@ export const BoxShadowContent = ({
/>
</Flex>
- <Flex direction="column">
- <Tooltip
- content={
- <Flex gap="2" direction="column">
- <Text variant="regularBold">Spread Radius</Text>
- <Text variant="monoBold">spread-radius</Text>
- <Text>
- Positive values will cause the
- <br />
- shadow to expand and grow
- <br />
- bigger, negative values will cause
- <br />
- the shadow to shrink.
- </Text>
- </Flex>
- }
- >
- <Label css={{ width: "fit-content" }}>Spread</Label>
- </Tooltip>
- <CssValueInputContainer
- key="boxShadowSpread"
- /*
+ {property === "boxShadow" ? (
+ <Flex direction="column">
+ <Tooltip
+ variant="wrapped"
+ content={
+ <Flex gap="2" direction="column">
+ <Text variant="regularBold">Spread Radius</Text>
+ <Text variant="monoBold">spread-radius</Text>
+ <Text>
+ Positive values will cause the shadow to expand and grow
+ bigger, negative values will cause the shadow to shrink.
+ </Text>
+ </Flex>
+ }
+ >
+ <Label css={{ width: "fit-content" }}>Spread</Label>
+ </Tooltip>
+ <CssValueInputContainer
+ key="boxShadowSpread"
+ /*
outline-offset is a fake property for validating box-shadow's spread.
*/
- property="outlineOffset"
- styleSource="local"
- keywords={[]}
- value={spread ?? { type: "unit", value: 0, unit: "px" }}
- setValue={(value) => handlePropertyChange({ spread: value })}
- deleteProperty={() =>
- handlePropertyChange({
- spread: spread ?? undefined,
- })
- }
- />
- </Flex>
+ property="outlineOffset"
+ styleSource="local"
+ keywords={[]}
+ value={spread ?? { type: "unit", value: 0, unit: "px" }}
+ setValue={(value) => handlePropertyChange({ spread: value })}
+ deleteProperty={() =>
+ handlePropertyChange({
+ spread: spread ?? undefined,
+ })
+ }
+ />
+ </Flex>
+ ) : null}
</Grid>
<Grid
@@ -317,6 +310,7 @@ export const BoxShadowContent = ({
>
<Flex direction="column">
<Tooltip
+ variant="wrapped"
content={
<Flex gap="2" direction="column">
<Text variant="regularBold">Color</Text>
@@ -346,47 +340,47 @@ export const BoxShadowContent = ({
/>
</Flex>
- <Flex direction="column">
- <Tooltip
- content={
- <Flex gap="2" direction="column">
- <Text variant="regularBold">Inset</Text>
- <Text variant="monoBold">inset</Text>
- <Text>
- Changes the shadow from
- <br />
- an outer shadow (outset) to an
- <br />
- inner shadow (inset).
- </Text>
- </Flex>
- }
- >
- <Label css={{ display: "inline" }}>Inset</Label>
- </Tooltip>
- <ToggleGroup
- type="single"
- value={inset?.value ?? "normal"}
- defaultValue="inset"
- onValueChange={(value) => {
- if (value === "inset") {
- handlePropertyChange({
- inset: { type: "keyword", value: "inset" },
- });
- } else {
- handlePropertyChange({ inset: undefined });
+ {property === "boxShadow" ? (
+ <Flex direction="column">
+ <Tooltip
+ variant="wrapped"
+ content={
+ <Flex gap="2" direction="column">
+ <Text variant="regularBold">Inset</Text>
+ <Text variant="monoBold">inset</Text>
+ <Text>
+ Changes the shadow from an outer shadow (outset) to an inner
+ shadow (inset).
+ </Text>
+ </Flex>
}
- }}
- >
- {boxShadowInsetValues.map(({ value, Icon }) => (
- <Tooltip key={value} content={toPascalCase(value)}>
- <ToggleGroupButton value={value}>
- <Icon />
- </ToggleGroupButton>
- </Tooltip>
- ))}
- </ToggleGroup>
- </Flex>
+ >
+ <Label css={{ display: "inline" }}>Inset</Label>
+ </Tooltip>
+ <ToggleGroup
+ type="single"
+ value={inset?.value ?? "normal"}
+ defaultValue="inset"
+ onValueChange={(value) => {
+ if (value === "inset") {
+ handlePropertyChange({
+ inset: { type: "keyword", value: "inset" },
+ });
+ } else {
+ handlePropertyChange({ inset: undefined });
+ }
+ }}
+ >
+ {boxShadowInsetValues.map(({ value, Icon }) => (
+ <Tooltip key={value} content={toPascalCase(value)}>
+ <ToggleGroupButton value={value}>
+ <Icon />
+ </ToggleGroupButton>
+ </Tooltip>
+ ))}
+ </ToggleGroup>
+ </Flex>
+ ) : null}
</Grid>
<Separator css={{ gridColumn: "span 2" }} />
@@ -403,23 +397,7 @@ export const BoxShadowContent = ({
<Label>
<Flex align={"center"} gap={1}>
Code
- <Tooltip
- variant="wrapped"
- content={
- <Text>
- Paste a box-shadow CSS code
- <br />
- without the property name, for
- <br />
- example:
- <br />
- <br />
- 0px 2px 5px 0px rgba(0, 0, 0, 0.2)
- </Text>
- }
- >
- <InfoCircleIcon />
- </Tooltip>
+ {tooltip}
</Flex>
</Label>
<TextArea
@@ -440,7 +418,7 @@ export const BoxShadowContent = ({
return;
}
- deleteProperty("boxShadow", { isEphemeral: true });
+ deleteProperty(property, { isEphemeral: true });
setIntermediateValue(undefined);
event.preventDefault();
}
diff --git a/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-layer.tsx b/apps/builder/app/builder/features/style-panel/shared/shadow-layer.tsx
similarity index 83%
rename from apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-layer.tsx
rename to apps/builder/app/builder/features/style-panel/shared/shadow-layer.tsx
index a06dc79a3e..57e2f31e42 100644
--- a/apps/builder/app/builder/features/style-panel/sections/box-shadows/box-shadow-layer.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/shadow-layer.tsx
@@ -12,11 +12,11 @@ import {
} from "@webstudio-is/icons";
import { useMemo } from "react";
import { FloatingPanel } from "~/builder/shared/floating-panel";
-import { BoxShadowContent } from "./box-shadow-content";
import { colord, type RgbaColor } from "colord";
import { toValue } from "@webstudio-is/css-engine";
-import { ColorThumb } from "../../shared/color-thumb";
-import type { LayerProps } from "../../style-layers-list";
+import { ColorThumb } from "../shared/color-thumb";
+import type { LayerProps } from "../style-layers-list";
+import { ShadowContent } from "./shadow-content";
const useLayer = (layer: TupleValue) => {
return useMemo(() => {
@@ -49,20 +49,31 @@ const useLayer = (layer: TupleValue) => {
}, [layer]);
};
-export const BoxShadowLayer = <T extends TupleValue>(props: LayerProps<T>) => {
- const { index, id, layer, isHighlighted, onDeleteLayer, onLayerHide } = props;
+export const ShadowLayer = <T extends TupleValue>(props: LayerProps<T>) => {
+ const {
+ index,
+ id,
+ layer,
+ isHighlighted,
+ onDeleteLayer,
+ onLayerHide,
+ label,
+ tooltip,
+ property,
+ } = props;
const properties = useLayer(layer);
-
const { name, shadow, color } = properties;
return (
<FloatingPanel
- title="Box Shadow"
+ title={label}
content={
- <BoxShadowContent
+ <ShadowContent
index={index}
+ property={property}
shadow={shadow}
layer={layer}
+ tooltip={tooltip}
onEditLayer={props.onEditLayer}
deleteProperty={props.deleteProperty}
/>
diff --git a/apps/builder/app/builder/features/style-panel/style-layers-list.tsx b/apps/builder/app/builder/features/style-panel/style-layers-list.tsx
index 9dbd0bb95c..05f09310c7 100644
--- a/apps/builder/app/builder/features/style-panel/style-layers-list.tsx
+++ b/apps/builder/app/builder/features/style-panel/style-layers-list.tsx
@@ -25,6 +25,7 @@ import type {
export type LayerProps<LayerType> = {
id: string;
index: number;
+ property: StyleProperty;
layer: LayerType;
label: string;
tooltip: JSX.Element;
@@ -108,6 +109,7 @@ export const LayersList = <
index,
layer,
disabled,
+ property,
isHighlighted: dragItemId === id,
onLayerHide: handleHideLayer,
onDeleteLayer: handleDeleteLayer,