{% extends "base.html" %}

{% block content %}
<div class="ui text container">
    <form class="center aligned ui form" action="" method="post" novalidate>
        {{ form.hidden_tag() }}
        <p>
            {{ form.username.label }}<br>
            {{ form.username(size=32) }}<br>
            {% for error in form.username.errors %}
            <span style="color: red;">[{{ error }}]</span>
            {% endfor %}
        </p>
        <p>{{ form.submit() }}</p>
    </form>

    {% if results %}
        <div class="ui relaxed divided list">
            {% for res in results %}
            <div class="item">
              <img alt="Avatar" class="ui avatar image" src="{{ res.avatar }}">
              <div class="content">
                {% if res.fullName|length > 20%}
                    <a class="header" href="/u/{{res.username}}">{{res.fullName[0:23]}}...</a>
                {% else %}
                    <a class="header" href="/u/{{res.username}}">{{res.fullName}}</a>
                {% endif %}
                <div class="description">{{res.username}}</div>
              </div>
            </div>
            {% endfor %}
        </div>
    {% endif %}
</div>

{% endblock %}