Sha256: ec22fc2e7c8319774193dc320cde7f406ff8c280d4bcd34ad04a5185c13b3373

Contents?: true

Size: 473 Bytes

Versions: 12

Compression:

Stored size: 473 Bytes

Contents

import { htmlAttributes } from "../html/html-attributes";

export class Box {
  attributes: Record<string, any>;
  children: any[];

  constructor(attributes: Record<string, any> = {}) {
    this.children = [];
    this.attributes = attributes;
  }

  add(child: any): this {
    this.children.push(child);
    return this;
  }

  get render(): string {
    return `<div ${htmlAttributes(this.attributes)}>${this.children.map(child => child.render).join("")}</div>`;
  }
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
clapton-0.0.12 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.11 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.10 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.9 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.8 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.7 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.6 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.5 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.4 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.3 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.2 lib/clapton/javascripts/src/components/box.ts
clapton-0.0.1 lib/clapton/javascripts/src/components/box.ts