File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import uuid
2+ from django import template
3+
4+ register = template .Library ()
5+
6+
7+ @register .simple_tag
8+ def generate_uuid ():
9+ return uuid .uuid4 ()
Original file line number Diff line number Diff line change 1+ .badge-button__radio {
2+ position : absolute;
3+ width : 1px ;
4+ height : 1px ;
5+ padding : 0 ;
6+ margin : -1px ;
7+ overflow : hidden;
8+ clip : rect (0 , 0 , 0 , 0 );
9+ white-space : nowrap;
10+ border : 0 ;
11+ }
12+
13+ .badge-button {
14+ width : fit-content;
15+ height : fit-content;
16+ padding : 2px ;
17+ display : inline-block;
18+ }
19+
20+ .badge-button : has (.badge-button__radio : checked ) {
21+ border-radius : var (--border-radius-m );
22+ border : 1px solid var (--color-stroke-mid );
23+ background : var (--color-surface-weak );
24+ padding : 1px ;
25+ }
26+
27+ .badge-button : hover {
28+ border-radius : var (--border-radius-m );
29+ border : 1px solid var (--color-stroke-strong );
30+ background : var (--color-surface-mid );
31+ padding : 1px ;
32+ }
Original file line number Diff line number Diff line change 4545@import "./post-filter.css" ;
4646@import "./library-filter.css" ;
4747@import "./contributors-list.css" ;
48+ @import "./badge-button.css" ;
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ <h3>{{ section_title }}</h3>
3030 - Styles: static/css/v3/v3-examples-section.css — h3 headings inside
3131 __block are styled via the structural selector (no class needed).
3232{% endcomment %}
33+ {% load static %}
3334< section class ="v3-examples-section " aria-labelledby ="v3-examples-heading ">
3435 < h2 id ="v3-examples-heading " class ="v3-examples-section__heading "> V3 Examples for testing</ h2 >
3536
@@ -66,6 +67,18 @@ <h3>{{ section_title }}</h3>
6667 </ div >
6768 {% endwith %}
6869
70+ {% with section_title="Badge Buttons" %}
71+ < div class ="v3-examples-section__block " id ="{{ section_title|slugify }} ">
72+ < h3 > {{ section_title }}</ h3 >
73+ {% static "img/v3/badges/badge-gold-medal.png" as icon_src %}
74+ < div class ="v3-examples-section__example-box ">
75+ {% include "v3/includes/_badge_button.html" with name="badge-select" value="gold" icon_src=icon_src only %}
76+ {% include "v3/includes/_badge_button.html" with name="badge-select" value="gold" icon_src=icon_src checked=True only %}
77+ {% include "v3/includes/_badge_button.html" with name="badge-select" value="gold" icon_src=icon_src only %}
78+ </ div >
79+ </ div >
80+ {% endwith %}
81+
6982 {% with section_title="Avatar" %}
7083 < div class ="v3-examples-section__block " id ="{{ section_title|slugify }} ">
7184 < h3 > {{ section_title }}</ h3 >
Original file line number Diff line number Diff line change 1+ {% comment %}
2+ {% endcomment %}
3+ {% load core_tags %}
4+
5+ {% generate_uuid as uuid %}
6+ < div class ="badge-button ">
7+ < input class ="badge-button__radio " type ="radio " name ="{{name}} " value ="{{value}} " id ="{{id|default:uuid}} " {% if checked %}checked{% endif %} />
8+ < label for ="{{id|default:uuid}} "> < img src ="{{ icon_src }} " alt ="" width ="32 " height ="32 "> </ label >
9+ </ div >
You can’t perform that action at this time.
0 commit comments