Skip to content

Commit

Permalink
Add a tag-list.inline
Browse files Browse the repository at this point in the history
The behavior has been a block accidentally, and changing the behavior would break a lot of layouts. I
considered adding a .block and using it for all legacy uses, but I think that the current behavior is
better in a number of cases.

Part of #678. Part of #670.
  • Loading branch information
jkomoros committed Nov 23, 2023
1 parent 3b914bd commit 89a837e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/tag-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ class TagList extends LitElement {
@property({ type : Object })
card: Card | null;

//By default hte tag-list has a display:block, which means it cannot occur
//as a peer to inline elements. This swaps it to an inline behavior. TODO:
//consider flipping the default to be inline:true and have an override for
//the old behavior, captured in issue #678.
@property({ type: Boolean })
inline: boolean;

static override styles = [
ButtonSharedStyles,
css`
Expand All @@ -115,6 +122,9 @@ class TagList extends LitElement {
.editing select {
display:inline;
}
.inline {
display:inline-block;
}
`
];

Expand All @@ -132,7 +142,7 @@ class TagList extends LitElement {
effectiveExcludeItems.forEach(item => excludeItemsAsMap[item] = true);
tagInfos = Object.fromEntries(Object.entries(tagInfos).filter(entry => !excludeItemsAsMap[entry[0]]));
return html`
<div class='${this.editing ? 'editing' : ''} ${this.subtle ? 'subtle' :''}'>
<div class='${this.editing ? 'editing' : ''} ${this.subtle ? 'subtle' :''} ${this.inline ? 'inline' : ''}'>
${allTags && allTags.length ?
allTags.map(item => html`<tag-chip .card=${this.card} .tagName=${item} .tagInfos=${this.tagInfos} .addition=${additions[item]} .deletion=${deletions[item]} .editing=${this.editing} .defaultColor=${this.defaultColor} .disabled=${this.disableTagIfMissingTagInfo && this.tagInfos && !this.tagInfos[item]} .disabledDescription=${this.disabledDescription || 'Disabled'} .tapEvents=${this.tapEvents} .subtle=${this.subtle || (this.subtleTags && this.subtleTags[item])}></tag-chip>`) :
(this.hideOnEmpty || this.hideMessageOnEmpty ? html`` : html`<em>No ${this.typeName.toLowerCase()}s</em>`)}
Expand Down

0 comments on commit 89a837e

Please sign in to comment.