Skip to content

Commit ea78649

Browse files
committed
new adminbar using django-cotton
1 parent 06486a2 commit ea78649

3 files changed

Lines changed: 38 additions & 21 deletions

File tree

hypha/apply/funds/templates/funds/rounds.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
{% block title %}{% trans "Rounds" %}{% endblock %}
66

77
{% block hero %}
8-
{% adminbar %}
9-
{% slot header %}{% trans "Rounds" %}{% endslot %}
10-
{% slot sub_heading %}{% trans "Explore current and past rounds" %}{% endslot %}
11-
{% endadminbar %}
8+
<c-adminbar
9+
title="{% trans 'Rounds' %}"
10+
subtitle="{% trans 'Explore current and past rounds' %}"
11+
/>
1212
{% endblock %}
1313

1414

hypha/static_src/sass/components/_admin-bar.scss

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,6 @@
66
&__inner {
77
max-width: variables.$site-width;
88
margin: 0 auto;
9-
10-
&--with-button {
11-
@include mixins.media-query(md) {
12-
display: flex;
13-
align-items: center;
14-
flex-direction: row;
15-
justify-content: space-between;
16-
}
17-
}
18-
}
19-
20-
&__meta {
21-
margin: 0 0 10px;
22-
23-
span {
24-
margin: 0 5px;
25-
}
269
}
2710

2811
&__back-link {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% load i18n %}
2+
3+
<c-vars padding="py-4" />
4+
{% translate "Go back" as back_default_text %}
5+
6+
<div
7+
class="bg-neutral text-neutral-content {{ padding }}"
8+
x-data="{ showBackButton: {{ back_link|yesno:'true,false' }} || (window.history && window.history.length > 1) }"
9+
data-test-id="admin-bar"
10+
>
11+
<div class="items-center md:flex md:justify-between container-constrained">
12+
<div>
13+
<a
14+
x-show="showBackButton"
15+
class="inline-flex items-center font-semibold transition-all hover:-translate-x-0.5 text-fg-muted hover:text-neutral-content"
16+
href="{{ back_link|default:'#' }}"
17+
{% if not back_link %}@click.prevent="window.history.back()"{% endif %}
18+
>
19+
← {{ back_link_text|default:back_default_text }}
20+
</a>
21+
<h1 class="mb-2 text-2xl font-medium md:m-0 md:text-3xl">{{ title }}</h1>
22+
{% if subtitle %}<p class="max-w-3xl text-sm truncate">{{ subtitle }}</p>
23+
{% endif %}
24+
</div>
25+
26+
{% if buttons %}
27+
<div class="self-end -mb-4">
28+
{{ buttons }}
29+
</div>
30+
{% endif %}
31+
32+
{{ slot }}
33+
</div>
34+
</div>

0 commit comments

Comments
 (0)