Skip to content

Commit

Permalink
Better handling of blur radius and spread values for shadows.
Browse files Browse the repository at this point in the history
  • Loading branch information
DomagojGojak committed Mar 16, 2023
1 parent 8e49b1d commit 8d8478d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions figma-exporter/src/figma/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@ export interface Effect {
readonly color?: Color;
readonly blendMode?: BlendMode;
readonly offset?: Vector2;
readonly spread: number;
}

/** A solid color, gradient, or image texture that can be applied as fills or strokes */
Expand Down
6 changes: 3 additions & 3 deletions figma-exporter/src/utils/convertColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ export const transformFigmaTextCaseToCssTextTransform = (textCase: FigmaTypes.Ty
};

export const transformFigmaEffectToCssBoxShadow = (effect: FigmaTypes.Effect): string => {
const { type, color, offset, radius, visible } = effect;
const { type, color, offset, radius, visible, spread } = effect;

if (!visible) {
return '';
}

if (type === 'DROP_SHADOW' && color && offset && radius) {
if (type === 'DROP_SHADOW' && color && offset) {
const { x, y } = offset;

return `${x}px ${y}px ${radius}px ${transformFigmaColorToCssColor(color)}`;
return `${x}px ${y}px ${radius ?? 0}px ${spread ? spread + 'px ' : ''}${transformFigmaColorToCssColor(color)}`;
}

return '';
Expand Down

0 comments on commit 8d8478d

Please sign in to comment.