generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PI-1449 Improve searching on input + added examples page
- Loading branch information
1 parent
58bb895
commit bd03d8d
Showing
10 changed files
with
123 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
.govuk-main-wrapper { | ||
min-height: 600px; | ||
} | ||
|
||
.example-output { | ||
background-color: govuk-colour('light-grey'); | ||
border: 1px solid $govuk-border-colour; | ||
margin-bottom: govuk-spacing(4); | ||
padding: govuk-spacing(4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/probation-search-frontend/components/probationSearch/results.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% from "govuk/components/pagination/macro.njk" import govukPagination %} | ||
{% from "govuk/components/table/macro.njk" import govukTable %} | ||
|
||
{% if params.results.response.totalElements > 0 %} | ||
<p>Showing {{ params.results.page.from }} to {{ params.results.page.to }} of {{ params.results.page.totalResults }} results.</p> | ||
{% endif %} | ||
|
||
{% if params.results.results is string %} | ||
{{ params.results.results | safe }} | ||
{% elif params.results.response.totalElements > 0 %} | ||
{{ govukTable({ firstCellIsHeader: true, head: params.results.results.head, rows: params.results.results.rows }) }} | ||
{% elif params.results.query != null %} | ||
<p>There are no results for your search. Try refining your query above.</p> | ||
{% endif %} | ||
|
||
{% if params.results.page.items | length > 1 %} | ||
{{ govukPagination({ previous: { href: params.results.page.prev }, next: { href: params.results.page.next }, items: params.results.page.items }) }} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% extends "../partials/layout.njk" %} | ||
{% from "probationSearch/macro.njk" import probationSearch %} | ||
|
||
{% set pageTitle = applicationName + " - Home" %} | ||
{% set mainClasses = "app-container govuk-body" %} | ||
|
||
{% block content %} | ||
<h1 class="govuk-heading-l">Examples</h1> | ||
<p>A collection of examples showing how the <a href="https://www.npmjs.com/package/@ministryofjustice/probation-search-frontend">probation-search-frontend</a> UI component can be configured.</p> | ||
|
||
<div class="govuk-!-width-two-thirds"> | ||
<ul class="govuk-list govuk-list--bullet"> | ||
<li> | ||
<h2 class="govuk-heading-m">Basic example</h2> | ||
<pre>{% raw %}{{ probationSearch({ id: "basic", results: probationSearchResults }) }}{% endraw %}</pre> | ||
<div class="example-output">{{ probationSearch({ id: "basic", results: probationSearchResults }) }}</div> | ||
</li> | ||
|
||
<li> | ||
<h2 class="govuk-heading-m">Search as you type</h2> | ||
<pre>{% raw %}{{ probationSearch({ id: "on-input", searchOnInput: true, results: probationSearchResults }) }}{% endraw %}</pre> | ||
<div class="example-output">{{ probationSearch({ id: "on-input", searchOnInput: true, results: probationSearchResults }) }}</div> | ||
</li> | ||
</ul> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters