Skip to content

Commit

Permalink
Add list support to sass const()
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Mar 6, 2017
1 parent 44cd9cb commit a78c438
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
9 changes: 6 additions & 3 deletions scripts/make.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,16 @@ const SassExtensions = {
const { get } = require('../src/common/util')

const value = get(SASS, name.getValue())
unit = unit.getValue()

if (typeof value === 'number') {
return new sass.types.Number(value, unit.getValue())
return new sass.types.Number(value, unit)
}

if (typeof value === 'number') {
return new sass.types.Number(value)
if (Array.isArray(value)) {
return value.reduce((list, val, i) => (
list.setValue(i, new sass.types.Number(val, unit)), list
), new sass.types.List(value.length))
}

return sass.types.Null.NULL
Expand Down
16 changes: 5 additions & 11 deletions src/stylesheets/partials/_tile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,18 @@
justify-content: center;
align-items: center;

$i: $tile-thumbnail-size-min;

@while $i <= $tile-thumbnail-size-max {
[data-size="#{$i}"] & {
$tile-size: #{round($i * $tile-factor)}px;
@each $size in const("ITEM.ZOOM") {
[data-size="#{$size}"] & {
$tile-size: #{round($size * $tile-factor)}px;

flex-basis: $tile-size;
height: $tile-size;

.thumbnail {
$size: #{$i}px;

width: $size;
height: $size;
width: #{$size}px;
height: #{$size}px;
}
}

$i: $i + $tile-size-step-min;
}

&.filler {
Expand Down

0 comments on commit a78c438

Please sign in to comment.