Skip to content

Commit

Permalink
Add horizontal version
Browse files Browse the repository at this point in the history
Close #39
  • Loading branch information
ofekashery committed Mar 23, 2020
1 parent 150f290 commit 50bb429
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Vertical Stack In Card allows you to group multiple cards in one card.
| type | string | **Required** | `custom:vertical-stack-in-card`
| cards | list | **Required** | List of cards
| title | string | **Optional** | Card title
| horizontal | boolean | **Optional** | Default: ``false``

## Installation

Expand All @@ -27,7 +28,7 @@ mv vertical-stack-in-card.js /config/www/

```yaml
resources:
- url: /local/vertical-stack-in-card.js?v=0.3.0
- url: /local/vertical-stack-in-card.js?v=0.3.1
type: js
```
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0
0.3.1
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.3.1
- Add horizontal version

## 0.3.0
- Fix [#75](https://github.com/ofekashery/vertical-stack-in-card/issues/75), [#78](https://github.com/ofekashery/vertical-stack-in-card/issues/78).

Expand Down
7 changes: 7 additions & 0 deletions vertical-stack-in-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ class VerticalStackInCard extends HTMLElement {
const cardContent = document.createElement('div');
card.header = config.title;
cards.forEach(card => cardContent.appendChild(card));
if (config.horizontal) {
cardContent.style.display = 'flex';
cardContent.childNodes.forEach(card => {
card.style.flex = '1 1 0';
card.style.minWidth = 0;
});
}
card.appendChild(cardContent);

while (this.hasChildNodes()) {
Expand Down

0 comments on commit 50bb429

Please sign in to comment.