How to use the lit-html/lib/repeat.repeat function in lit-html

To help you get started, we’ve selected a few lit-html examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frame00 / oo-elements / src / elements / oo-profile-editor / index.ts View on Github external
&.success {
					background: var(--resolved-background);
				}
			}
			button {
				margin-top: 3rem;
				@mixin button;
			}
		
		<main>
			<form>
				<dl>
					${repeat(options, opt =&gt; {
						const { title, template } = opt
						return html`
						<dt>${title}</dt>
						<dd>${template}</dd>
						`
					})}
				</dl>
				<button>Save</button>
			</form>
		</main>
		`
	}
github abraham / node-package / src / success.view.ts View on Github external
private get keywords(): TemplateResult {
    return html`
      <div class="row ellipsis" id="keywords">
        ${repeat(this.pkg.keywords, keyword =&gt; keyword, (keyword, _index) =&gt; this.keyword(keyword))}
      </div>
    `;
  }
github frame00 / oo-elements / src / elements / oo-project-messages / index.ts View on Github external
}
			p:not(:last-child) {
				margin-bottom: 1rem;
			}
			[slot=body] {
				padding: 1rem;
			}
			[data-tooltip-position] {
				width: 80%;
			}
			[data-tooltip-position=right] {
				margin-left: 20%;
			}
		
		${more}
		${repeat(mess, mes =&gt; message(user, mes))}
		`
	}
github abraham / node-package / src / success.view.ts View on Github external
private get install(): TemplateResult {
    return html`
      <div class="row" id="install">
        <div id="tabs">
          ${repeat(this.pkg.installCommands(this.component.global), command =&gt; command.id, (command, _index) =&gt; this.installTab(command))}
        </div>
        <div class="row-horizontal" id="commands">
          ${repeat(this.pkg.installCommands(this.component.global), command =&gt; command.id, (command, _index) =&gt; this.installCommand(command))}
          <div class="item">
            <a title="Copy command" href="#" id="copy"> this.copyInstallCommand(event)}&gt;${this.copy}</a>
          </div>
        </div>
      </div>
    `;
  }
github frame00 / oo-elements / src / elements / _organisms / oo-organisms-ask-step-sign-in / index.ts View on Github external
const buttons = f =&gt; {
			const provs = ['google', 'facebook', 'github']
			const popup = prov =&gt;
				html``
			const redirect = prov =&gt;
				html``
			if (f === 'popup') {
				return repeat(provs, prov =&gt; popup(prov))
			}
			if (f === 'redirect') {
				return repeat(provs, prov =&gt; redirect(prov))
			}
		}
github frame00 / oo-elements / src / elements / _atoms / oo-atoms-select-scope / index.ts View on Github external
font-weight: 400;
				text-transform: capitalize;
				font-family: var(--font-family);
				background: #f1eedf;
			}
			.active {
				button {
					font-weight: 700;
					background: var(--yellow);
					color: black;
				}
			}
		
		
			<ul>
				${repeat(values, item =&gt; html`
				<li scope="">
					<button>
						${item}${item === 'private' ? ` (${price})` : ''}
					</button>
				</li>`)}
			</ul>
		
		`
	}
github frame00 / oo-elements / src / elements / oo-project-status / index.ts View on Github external
}
				&amp;.public {
					background: #4CAF50;
				}
				&amp;.private {
					background: #607D8B;
				}
				&amp;.unassigned {
					background: #3F51B5;
				}
				&amp;.forked {
					background: rebeccapurple;
				}
			}
		
		${repeat(labels, label =&gt; label)}
		`
	}
github frame00 / oo-elements / src / lib / tags.ts View on Github external
export const template = (tags: string[], opts?: Options) =&gt; {
	const { className = 'tags' } = opts || {}
	return html`<div>${repeat(
		tags,
		tag =&gt;
			html`<span><a>${tag}</a></span>`
	)}</div>`
}
github kepta / idly / packages / idly-gl / src / ui / EntityTree.ts View on Github external
function TreeBranch(
  title: string,
  parent: RecursiveRecord,
  actions: Actions,
  depth: number,
  selectedId?: string,
  hoverId?: string
) {
  const keys = Object.keys(parent);
  if (keys.length === 0) {
    return;
  }
  return html`
    <div class="title">${title}</div>
      ${repeat(
        Object.keys(parent),
        p =&gt; p,
        item =&gt; {
          const val = parent[item];
          if (typeof val === 'string' || val == null) {
            return html`
                 ${TreeLeaf({
                   id: item,
                   selected: selectedId === item,
                   expanded: false,
                   hovered: hoverId === item,
                   unavailable: val == null,
                   parent,
                   actions,
                 })}
             `;
github kepta / idly / packages / idly-gl / src / ui / LayerManager / index.ts View on Github external
export function LayerManager(
  glLayers: any[],
  actions: Actions
): TemplateResult {
  return Box({
    title: 'LayerManager',
    children: html`
    <div class="layout vertical">
    ${repeat(
      glLayers.filter(r =&gt; !r.internal &amp;&amp; !r.layer.id.includes('casing')),
      gl =&gt; gl.id,
      (item, index) =&gt; {
        const name = reverseGetNameSpacedLayerId(item.layer.id);
        return html`
                <span>
                    <input type="checkbox"> actions.modifyLayerHide(item.layer.id)}
                    &gt;
                    <label> ${name}</label>
                </span>
                `;
      }</div>