@mixin g-decor_state($offset, $sprite-offset, $state-index: 1) { $state-offset: $offset + $sprite-offset * 3 * $state-index; > .fill { background-position: center (0 - $state-offset) !important; } > .left { background-position: left (0 - $state-offset - $sprite-offset) !important; } > .right { background-position: right (0 - $state-offset - $sprite-offset * 2) !important; } } @mixin g-decor_type($texture, $offset, $sprite-offset, $decor_width: false) { @if $decor_width { padding: 0 $decor_width; > .left, > .right { width: $decor_width + 1 !important; } } > .fill, > .left, > .right { background-image: image-url("#{$texture}") !important; } @include g_decor_state($offset, $sprite-offset, 0); } @mixin g-decor($decor_width, $texture: false, $offset: 0, $sprite-offset: 0, $height: false) { position: relative; white-space: nowrap; @if $height { height: $height; } > .fill { display: block; position: relative; height: 100%; } > .left, > .right { display: block; height: 100%; position: absolute; top: 0; } @if $texture { @include g_decor_type($texture, $offset, $sprite-offset, $decor_width); } > .left { left: 0; } > .right { right: 0; } } @mixin g-star-decor_state($sprite-offset, $state) { $offset_top: 0 - ($state * $sprite-offset * 2); $offset_bottom: $offset_top - $sprite-offset; > .corner { &.left.top { background-position: right $offset_bottom; } &.right.top { background-position: left $offset_bottom; } &.left.bottom { background-position: right $offset_top; } &.right.bottom { background-position: left $offset_top; } } } @mixin g-star-decor($texture, $size, $sprite-offset, $state: 0) { > .corner { width: $size; height: $size; position: absolute; background: image-url("#{$texture}") no-repeat; &.left { left: 0; } &.right { right: 0; } &.top { top: 0; *top: 1px; } &.bottom { bottom: 0; *bottom: 1px; } } @include g-star-decor_state($sprite-offset, $state); }