• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

marcomontalbano / figma-export / 8040637088

25 Feb 2024 08:41PM CUT coverage: 96.473%. Remained the same
8040637088

push

github

web-flow
Merge pull request #162 from marcomontalbano/add-overrides-for-axios

Add `overrides` for axios

236 of 258 branches covered (91.47%)

Branch coverage included in aggregate %.

612 of 621 relevant lines covered (98.55%)

17.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.33
/packages/core/src/lib/figmaStyles/effectStyle.ts
1
import * as Figma from 'figma-js';
2
import * as FigmaExport from '@figma-export/types';
3

4
import { notNullish } from '../utils';
1✔
5
import { extractColor } from './paintStyle';
1✔
6

7
const createEffectStyle = (effect: Figma.Effect): FigmaExport.EffectStyle | undefined => {
1✔
8
    // eslint-disable-next-line default-case
9
    switch (effect.type) {
37✔
10
        case 'INNER_SHADOW':
11
        case 'DROP_SHADOW': {
12
            const color = extractColor(effect);
26✔
13
            const spreadRadius = 0;
26✔
14
            const inset = effect.type === 'INNER_SHADOW';
26✔
15

16
            if (color && effect.offset) {
26!
17
                return {
26✔
18
                    type: effect.type,
19
                    visible: effect.visible,
20
                    color,
21
                    inset,
22
                    offset: effect.offset,
23
                    blurRadius: effect.radius,
24
                    spreadRadius,
25

26
                    // eslint-disable-next-line max-len
27
                    value: `${inset ? 'inset ' : ''}${effect.offset.x}px ${effect.offset.y}px ${effect.radius}px ${spreadRadius}px ${color.rgba}`,
26✔
28
                };
29
            }
30

31
            break;
×
32
        }
33

34
        case 'LAYER_BLUR': {
35
            return {
8✔
36
                type: effect.type,
37
                visible: effect.visible,
38
                blurRadius: effect.radius,
39
                value: `blur(${effect.radius}px)`,
40
            };
41
        }
42
    }
43

44
    return undefined;
3✔
45
};
46

47
const parse = (node: FigmaExport.StyleNode): FigmaExport.StyleTypeEffect | undefined => {
1✔
48
    if (node.styleType === 'EFFECT' && node.type === 'RECTANGLE') {
43✔
49
        return {
26✔
50
            styleType: 'EFFECT',
51
            effects: Array.from(node.effects)
52
                .reverse()
53
                .map(createEffectStyle)
54
                .filter(notNullish),
55
        };
56
    }
57

58
    return undefined;
17✔
59
};
60

61
export {
62
    parse,
1✔
63
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc