11{# Primary button -#}
2- {% macro primary_button(id, content, rounded, extra_styles = None, disabled = false) %}
3- {% let extra_styles_ = extra_styles.unwrap_or("") %}
2+ {% macro primary_button(id, content, rounded, extra_styles = None, disabled = false) - %}
3+ {% let extra_styles_ = extra_styles.unwrap_or("") - %}
44
55 < button id ="{{ id }} "
6- class ="{%- if rounded -%} p-2.5 h-[44px] w-[44px] {%- else -%} py-1.5 px-5 h-[40px] {%- endif %} text-base font-medium text-center text-white rounded-full bg-primary-500
7- {% if !disabled -%}
8- hover:bg-primary-700 focus:ring-4 focus:ring-primary-300 active:ring-4 active:ring-primary-300 focus:bg-primary-700 focus:text-white {%- endif %} {{ extra_styles_ }} "
6+ class ="{%- if rounded -%} p-2.5 h-[44px] w-[44px] {%- else -%} py-1.5 px-5 h-[40px] {%- endif %} text-base font-medium text-center text-white rounded-full bg-primary-500 {%+ if !disabled %} hover:bg-primary-700 focus:ring-4 focus:ring-primary-300 active:ring-4 active:ring-primary-300 focus:bg-primary-700 focus:text-white {%- endif %} {{ extra_styles_ }} "
97 disabled ="{{ disabled }} "> {{ content|safe }}</ button >
10- {% endmacro %}
8+ {% endmacro primary_button - %}
119{# End primary button -#}
1210
1311{# Primary link -#}
14- {% macro primary_link(content, href, rounded, extra_styles = None) %}
15- {% let extra_styles_ = extra_styles.unwrap_or("") %}
12+ {% macro primary_link(content, href, rounded, extra_styles = None) - %}
13+ {% let extra_styles_ = extra_styles.unwrap_or("") - %}
1614
1715 < a class ="{%- if rounded -%} p-2.5 h-[44px] w-[44px] {%- else -%} py-2 px-5 {%- endif %} inline-block text-base font-medium text-center text-white rounded-full bg-primary-500 hover:bg-primary-700 focus:ring-4 focus:ring-primary-300 active:ring-4 active:ring-primary-300 focus:bg-primary-700 focus:text-white {{ extra_styles_ }} "
1816 href ="{{ href }} "> {{ content|safe }}</ a >
19- {% endmacro %}
17+ {% endmacro primary_link - %}
2018{# End primary link -#}
2119
2220{# Secondary button -#}
23- {% macro secondary_button(id, content, rounded, extra_styles = None, disabled = false) %}
24- {% let extra_styles_ = extra_styles.unwrap_or("") %}
21+ {% macro secondary_button(id, content, rounded, extra_styles = None, disabled = false) - %}
22+ {% let extra_styles_ = extra_styles.unwrap_or("") - %}
2523
2624 < button id ="{{ id }} "
27- class ="group
28- {% if rounded -%}
29- p-1.5 h-[30px] w-[30px] {%- else -%} py-1.5 px-5 h-[40px] {%- endif %} bg-white items-center text-base font-medium text-center text-primary-500 rounded-full border border-primary-500
30- {% if !disabled -%}
31- hover:bg-primary-500 hover:text-white hover:bg-gray-100 focus:ring-4 focus:ring-primary-300 active:ring-4 active:ring-primary-300 focus:bg-primary-700 focus:text-white {%- endif %} {{ extra_styles_ }} "
25+ class ="group {%+ if rounded %} p-1.5 h-[30px] w-[30px] {%- else -%} py-1.5 px-5 h-[40px] {%- endif %} bg-white items-center text-base font-medium text-center text-primary-500 rounded-full border border-primary-500 {%+ if !disabled %} hover:bg-primary-500 hover:text-white hover:bg-gray-100 focus:ring-4 focus:ring-primary-300 active:ring-4 active:ring-primary-300 focus:bg-primary-700 focus:text-white {%- endif %} {{ extra_styles_ }} "
3226 disabled ="{{ disabled }} "> {{ content|safe }}</ button >
33- {% endmacro %}
27+ {% endmacro secondary_button - %}
3428{# End secondary button -#}
3529
3630{# Secondary mini button -#}
37- {% macro secondary_mini_button(id, content, extra_styles = None) %}
38- {% let extra_styles_ = extra_styles.unwrap_or("") %}
31+ {% macro secondary_mini_button(id, content, extra_styles = None) - %}
32+ {% let extra_styles_ = extra_styles.unwrap_or("") - %}
3933
4034 < button id ="{{ id }} "
4135 class ="bg-white items-center py-1 px-3 text-xs text-center text-primary-500 rounded-full border border-primary-500 hover:text-white hover:bg-primary-500 focus:ring-4 focus:ring-primary-300 active:ring-4 active:ring-primary-300 focus:bg-primary-700 focus:text-white {{ extra_styles_ }} ">
4236 {{ content|safe }}
4337 </ button >
44- {% endmacro %}
38+ {% endmacro secondary_mini_button - %}
4539{# End secondary mini button -#}
4640
4741{# Secondary link -#}
48- {% macro secondary_link(content, href, rounded, extra_styles = None) %}
49- {% let extra_styles_ = extra_styles.unwrap_or("") %}
42+ {% macro secondary_link(content, href, rounded, extra_styles = None) - %}
43+ {% let extra_styles_ = extra_styles.unwrap_or("") - %}
5044
5145 < a class ="{%- if rounded -%} p-2 h-[44px] w-[44px] {%- else -%} py-2 px-5 {%- endif %} inline-block bg-white items-center text-base font-medium text-center text-primary-500 rounded-full border border-primary-500 hover:bg-primary-500 hover:text-white focus:ring-4 focus:ring-primary-300 active:ring-4 active:ring-primary-300 focus:bg-primary-700 focus:text-white {{ extra_styles_ }} "
5246 href ="{{ href }} "> {{ content|safe }}</ a >
53- {% endmacro %}
47+ {% endmacro secondary_link - %}
5448{# End secondary link -#}
5549
5650{# Search bar -#}
57- {% macro search_bar(placeholder, input_styles, container_styles, with_help, value = None) %}
58- {% let value_ = value.clone().unwrap_or("".to_string()) %}
51+ {% macro search_bar(placeholder, input_styles, container_styles, with_help, value = None) - %}
52+ {% let value_ = value.clone().unwrap_or("".to_string()) - %}
5953
6054 < div class ="flex items-center {{ container_styles }} ">
6155 < div class ="relative {{ input_styles }}
7569 </ button >
7670 </ div >
7771 < div class ="absolute right-[6px] top-[5px] ">
78- {# djlint:off H008 #}
79- {% call secondary_button(id = "search-btn", content = "< div class ='svg-icon h-4 w-4 mx-auto bg-primary-500 group-hover:bg-white icon-magnifying-glass '> </ div > ", rounded = true, extra_styles = Some("mt-[3px] mr-[3px]")) %}
80- {# djlint:on H008 #}
72+ {# djlint:off H008 - #}
73+ {% call secondary_button(id = "search-btn", content = "< div class ='svg-icon h-4 w-4 mx-auto bg-primary-500 group-hover:bg-white icon-magnifying-glass '> </ div > ", rounded = true, extra_styles = Some("mt-[3px] mr-[3px]")) - %}
74+ {# djlint:on H008 - #}
8175 </ div >
8276
83- {% if with_help %}
77+ {% if with_help - %}
8478 < div class ="absolute hidden -right-[1.5rem] top-0 md:block ">
8579 < button id ="open-search-tips-modal ">
8680 < div class ="svg-icon w-4 h-4 bg-gray-300 hover:bg-gray-700 icon-question-mark "> </ div >
@@ -142,22 +136,22 @@ <h3 class="text-xl font-semibold text-gray-900">Search tips</h3>
142136 closeSearchTipsModal . addEventListener ( 'click' , ( ) => toggleModalVisibility ( 'search-tips' ) ) ;
143137 }
144138 </ script >
145- {% endif %}
139+ {% endif - %}
146140 </ div >
147141 </ div >
148- {% endmacro %}
142+ {% endmacro search_bar - %}
149143{# End search bar -#}
150144
151145{# Alert -#}
152- {% macro alert(title, content) %}
146+ {% macro alert(title, content) - %}
153147 < div class ="p-10 md:p-14 ">
154148 < div class ="border border-primary-300 p-10 text-sm text-gray-800 rounded-lg bg-primary-50 text-center "
155149 role ="alert ">
156150 < div class ="text-xl mb-6 "> {{ title }}</ div >
157151 {{ content }}
158152 </ div >
159153 </ div >
160- {% endmacro %}
154+ {% endmacro alert - %}
161155{# End alert -#}
162156
163157{# Current page -#}
@@ -168,30 +162,30 @@ <h3 class="text-xl font-semibold text-gray-900">Search tips</h3>
168162 1 - {{ items_number }}
169163 {%- endif -%}
170164 {{ "" }} of {{ total }} results
171- {%- endmacro %}
165+ {%- endmacro current_page - %}
172166{# End current page -#}
173167
174168{# Logo -#}
175- {% macro logo(logo_url, classes, size, color, name = None) %}
176- {% if let Some(logo_url) = logo_url %}
177- {% let bg_image = logo_url.replace("c_fill,dpr_2,f_auto,g_center,q_auto:good", &format!("c_scale,w_{}", *size * 2) ) %}
169+ {% macro logo(logo_url, classes, size, color, name = None) - %}
170+ {% if let Some(logo_url) = logo_url - %}
171+ {% let bg_image = logo_url.replace("c_fill,dpr_2,f_auto,g_center,q_auto:good", &format!("c_scale,w_{}", *size * 2) ) - %}
178172
179173 < div class ="md:my-auto bg-white rounded-lg outline outline-1 outline-gray-300 border border-[5px] border-white overflow-hidden bg-no-repeat bg-center bg-contain {{ classes }} "
180174 style ="background-image: url('{{ bg_image }}') "> </ div >
181- {% else %}
175+ {% else - %}
182176 < div class ="relative md:my-auto bg-white rounded-lg outline outline-1 outline-gray-300 border border-[5px] border-white overflow-hidden bg-no-repeat bg-center bg-contain {{ classes }} ">
183177 < div class ="relative h-full w-full flex place-items-center p-2 text-[0.78rem] text-gray-600 font-bold leading-5 capitalize z-10 ">
184178 < p class ="w-full text-ellipsis overflow-hidden text-center "> {{ name.unwrap_or(&"".to_string() ) }}</ p >
185179 </ div >
186180 < div class ="absolute w-full h-full top-0 placeholder-logo "
187181 style ="background-color: {{ color }} "> </ div >
188182 </ div >
189- {% endif %}
190- {% endmacro %}
183+ {% endif - %}
184+ {% endmacro logo - %}
191185{# End logo -#}
192186
193- {# Small spinner #}
194- {% macro small_spinner() %}
187+ {# Small spinner - #}
188+ {% macro small_spinner() - %}
195189 < div role ="status " class ="hidden group-[.is-loading]:block ">
196190 < svg aria-hidden ="true "
197191 class ="w-6 h-6 text-gray-200 animate-spin fill-primary-500 "
@@ -203,5 +197,17 @@ <h3 class="text-xl font-semibold text-gray-900">Search tips</h3>
203197 </ svg >
204198 < span class ="sr-only "> Loading...</ span >
205199 </ div >
206- {% endmacro %}
207- {# End small spinner #}
200+ {% endmacro small_spinner -%}
201+ {# End small spinner -#}
202+
203+ {# Main loading -#}
204+ {% macro main_loading() -%}
205+ < div class ="w-20 h-20 text-gray-200 animate-spin ">
206+ < img src ="/static/images/icons/main_loading.svg "
207+ height ="20 "
208+ width ="20 "
209+ alt ="Loading icon "
210+ class ="w-full h-full object-contain " />
211+ </ div >
212+ {% endmacro main_loading -%}
213+ {# End main loading -#}
0 commit comments