protected async function renderAsync()

in src/site/xhp/ui-button.php [39:85]


  protected async function renderAsync(): Awaitable<x\node> {
    $holder_class = ($this->:className !== null)
      ? "buttonHolder ".$this->:className
      : "buttonHolder";
    $button_class = "button button".
      \ucfirst($this->:use).
      " button".
      \ucfirst($this->:size);

    $glyph = null;
    $glyph_icon = $this->:glyph;
    if ($glyph_icon !== null) {
      $holder_class .= " buttonWithGlyph";
      $glyph = <glyph icon={$glyph_icon} />;
    }

    if ($this->:href !== null) {
      $button =
        <a
          class={$button_class}
          href={$this->:href}
          role="button"
          target={$this->:target}>
          {$glyph}
          <span class="buttonText">{$this->getChildren()}</span>
        </a>;
    } else {
      $button =
        <div class={$button_class} role="button">
          {$glyph}
          <span class="buttonText">{$this->getChildren()}</span>
        </div>;
    }

    if ($this->:inline) {
      $holder_class .= " buttonInlineHolder";
    }

    if ($this->:align === 'right') {
      $holder_class .= " buttonAlignRight";
    }

    return
      <div class={$holder_class}>
        {$button}
      </div>;
  }