Skip to content

Commit

Permalink
feat: add support for long items
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 16, 2020
1 parent e9c02b3 commit 1c11513
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@ export class MarkdownRenderComponent implements OnInit, OnChanges, AfterViewInit
const maxItem = maxBy(items, (d) => d.childrens.length);
const maxLength = maxItem.childrens.length;

let maxWidthClass = '';
const MAX_ONE_COLUMN = 10;
if (maxLength > MAX_ONE_COLUMN) {
maxWidthClass = 'process-step-max';
}

let cols = '';
// tslint:disable-next-line:prefer-for-of
for (let i = 0; i < items.length; i++) {
Expand All @@ -413,12 +419,12 @@ export class MarkdownRenderComponent implements OnInit, OnChanges, AfterViewInit
text = items[i].childrens[j].item.text;
}
if (text !== '') {
itemsStr += `<div class="process-step-item">${text}</div>`;
itemsStr += `<div class="process-step-item ${maxWidthClass}">${text}</div>`;
}
}

cols += `<div class="process-step-column">
<div class="process-title">${title}</div><div class="process-body">${itemsStr}</div>
<div class="process-title">${title}</div><div class="process-body ${maxWidthClass === '' ? '' : 'process-long-body' }">${itemsStr}</div>
</div>`;
}

Expand Down
14 changes: 14 additions & 0 deletions src/styles/_process-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@

.process-body {
padding: 1em;

&.process-long-body {
display: flex;
align-items: center;
justify-content: center;
flex-direction: row;
flex-wrap: wrap;
flex-flow: row wrap;
align-content: flex-end;
}
}

.process-step-item {
Expand All @@ -241,6 +251,10 @@
border-right: 1px solid #222;
border-top: 1px solid #222;
border-bottom: 1px solid #222;

&.process-step-max {
width: 50%;
}
}
}
}

0 comments on commit 1c11513

Please sign in to comment.