diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fb12426..86300823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.26.3 + +- widgets + - strip: `spacing` now accepts percents + ## 0.26.2 - bug fixes diff --git a/resources/docs/widgets/containers.md b/resources/docs/widgets/containers.md index 12d676ad..aad21774 100644 --- a/resources/docs/widgets/containers.md +++ b/resources/docs/widgets/containers.md @@ -81,9 +81,9 @@ Unidirectionnal panel with stretching capability. By default, children widgets t - usage: set to `true` to stretch widgets evenly ### `spacing` -- type: `integer` +- type: `integer|percentage` - default: `0` -- usage: adds space between widgets +- usage: adds space between widgets. Percents are always relative to the strips width. ### `border` - type: `boolean` diff --git a/src/browser/js/app/widgets/containers/strip.js b/src/browser/js/app/widgets/containers/strip.js index b9ad7956..49d388cc 100644 --- a/src/browser/js/app/widgets/containers/strip.js +++ b/src/browser/js/app/widgets/containers/strip.js @@ -46,7 +46,11 @@ module.exports = class Strip extends Panel { super(options) - this.widget.style.setProperty('--spacing', this.getProp('spacing')) + if (this.getProp('spacing')) { + var spacing = this.getProp('spacing') + if (!isNaN(spacing)) spacing += 'rem' + this.widget.style.setProperty('--spacing', spacing) + } this.container.classList.add(this.getProp('horizontal') ? 'horizontal' : 'vertical') if (this.getProp('stretch')) this.container.classList.add('stretch') diff --git a/src/browser/scss/widgets/_panel.scss b/src/browser/scss/widgets/_panel.scss index 5cd28a26..0b6cbccf 100644 --- a/src/browser/scss/widgets/_panel.scss +++ b/src/browser/scss/widgets/_panel.scss @@ -132,11 +132,11 @@ display: flex; flex-direction: column; align-items: stretch; - padding: calc(var(--spacing) / 2 * 1rem); + padding: calc(var(--spacing) / 2); > .widget { width: auto!important; max-width: 100%; - margin: calc(var(--spacing) / 2 * 1rem); + margin: calc(var(--spacing) / 2); } } } @@ -145,11 +145,11 @@ display: flex; flex-direction: row; align-items: stretch; - padding: calc(var(--spacing) / 2 * 1rem); + padding: calc(var(--spacing) / 2); > .widget { height: auto!important; max-height: 100%; - margin: calc(var(--spacing) / 2 * 1rem); + margin: calc(var(--spacing) / 2); } }