Skip to content

Commit

Permalink
limit popular searches
Browse files Browse the repository at this point in the history
  • Loading branch information
precious-onyenaucheya-ons committed Jan 30, 2025
1 parent 7bf2beb commit 4d81fc4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 13 additions & 8 deletions src/components/header/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,20 @@
<h2 class="ons-u-fs-s--b ons-u-mb-s ons-header-nav-search__heading">Popular Searches</h2>
<ul class="ons-list ons-list--bare ons-list--inline">
{% for item in params.searchLinks.popularSearches %}
<li class="ons-list__item">
{% if item.text %}
{% if item.url %}
<a href="{{ item.url }}" class="ons-u-fs-s ons-header-nav-search__text">{{ item.text }} </a>
{% else %}
<p class="ons-u-fs-s ons-header-nav-search__text">{{ item.text }}</p>
{# Limiting the popular searches to 5 #}
{% if loop.index <= 5 %}
<li class="ons-list__item">
{% if item.text %}
{% if item.url %}
<a href="{{ item.url }}" class="ons-u-fs-s ons-header-nav-search__text"
>{{ item.text }}
</a>
{% else %}
<p class="ons-u-fs-s ons-header-nav-search__text">{{ item.text }}</p>
{% endif %}
{% endif %}
{% endif %}
</li>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/header/example-header-with-search-button.njk
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"url": '#0',
"text": 'Wellbeing',
"external": true
},{
},
{
"url": '#0',
"text": 'Baby names',
"external": true
Expand Down

0 comments on commit 4d81fc4

Please sign in to comment.