Skip to content

Commit 5faab4f

Browse files
feat: Responsive UI Header (#1792)
* feat: responsive UI * chore: removed comments * fix: starting whitespace characters fix
1 parent c9fc452 commit 5faab4f

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

application/CohortManager/src/Web/app/components/search-nhs-number.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ export function SearchNhsNumber() {
77
const [nhsNumber, setNhsNumber] = useState("");
88

99
const isValidNhsNumber = (value: string): boolean => {
10-
const cleaned = value.replaceAll(" ", "");
10+
const cleaned = value.trim().replaceAll(" ", "");
1111
return cleaned.length === 10 && /^\d+$/.test(cleaned);
1212
};
1313

1414
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
1515
e.preventDefault();
16-
const cleanedNhsNumber = nhsNumber.replaceAll(" ", "");
16+
const cleanedNhsNumber = nhsNumber.trim().replaceAll(" ", "");
1717

1818
if (!isValidNhsNumber(nhsNumber)) {
1919
router.push(`/exceptions/noResults`);
@@ -39,12 +39,11 @@ export function SearchNhsNumber() {
3939
};
4040

4141
return (
42-
<search className="nhsuk-header__search">
43-
<form
44-
className="nhsuk-header__search-form"
45-
id="search"
46-
onSubmit={handleSubmit}
47-
>
42+
<form
43+
className="nhsuk-header__search-form"
44+
id="search"
45+
onSubmit={handleSubmit}
46+
>
4847
<label className="nhsuk-u-visually-hidden" htmlFor="search-field">
4948
Search by NHS number
5049
</label>
@@ -74,6 +73,5 @@ export function SearchNhsNumber() {
7473
</svg>
7574
</button>
7675
</form>
77-
</search>
7876
);
7977
}

application/CohortManager/src/Web/app/globals.scss

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,9 @@
165165
.nhsuk-header__content {
166166
display: flex;
167167
align-items: center;
168+
gap: clamp(8px, 2vw, 24px);
169+
flex-wrap: wrap;
168170
justify-content: space-between;
169-
flex-wrap: nowrap;
170171
}
171172

172173
.nhsuk-header__service {
@@ -176,16 +177,12 @@
176177

177178
.nhsuk-header__search {
178179
flex: 1;
179-
min-width: 250px;
180-
}
181-
182-
.nhsuk-header .nhsuk-header__search {
183-
margin: 0 100px;
180+
min-width: min(240px, 40vw);
181+
max-width: 420px;
184182
}
185183

186184
.nhsuk-header__search-form {
187185
display: flex;
188-
fill: currentColor;
189186
}
190187

191188
.nhsuk-header__account {

0 commit comments

Comments
 (0)