strip: spacing: add support for percents (#215)
This commit is contained in:
parent
8ecd4abfce
commit
4f3af11c45
4 changed files with 16 additions and 7 deletions
|
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## 0.26.3
|
||||
|
||||
- widgets
|
||||
- strip: `spacing` now accepts percents
|
||||
|
||||
## 0.26.2
|
||||
|
||||
- bug fixes
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue