Skip to content

Commit

Permalink
Increase readability for 'output-styles-as-sass' (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomontalbano committed Sep 3, 2020
1 parent b7151a9 commit a3f1c3e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/output-styles-as-sass/src/index.ts
Expand Up @@ -27,22 +27,26 @@ export = ({
case 'FILL': {
const value = style.fills
.filter((fill) => fill.visible)
.reduce((acc, fill, index) => `${acc}${index > 0 ? ', ' : ''}${fill.value}`, '');
.map((fill) => fill.value)
.join(', ');

text += writeVariable(style.comment, style.name, value, getExtension());

break;
}

case 'EFFECT': {
const visibles = style.effects.filter((effect) => effect.visible);
const boxShadowValue = visibles
const visibleEffects = style.effects.filter((effect) => effect.visible);

const boxShadowValue = visibleEffects
.filter((effect) => effect.type === 'INNER_SHADOW' || effect.type === 'DROP_SHADOW')
.reduce((acc, effect, index) => `${acc}${index > 0 ? ', ' : ''}${effect.value}`, '');
.map((effect) => effect.value)
.join(', ');

const filterBlurValue = visibles
const filterBlurValue = visibleEffects
.filter((effect) => effect.type === 'LAYER_BLUR')
.reduce((acc, effect, index) => `${acc}${index > 0 ? ', ' : ''}${effect.value}`, '');
.map((effect) => effect.value)
.join(', ');

// TODO: add to documentation. "you cannot combine shadow and blur effects"
text += writeVariable(style.comment, style.name, boxShadowValue || filterBlurValue, getExtension());
Expand Down

0 comments on commit a3f1c3e

Please sign in to comment.