Skip to content

Commit 1ab3f59

Browse files
author
Ibrahim Haizel
committed
refactor: update markup and styling for Smart Source Selection example and clean up console logs
1 parent 7cfe02f commit 1ab3f59

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

src/wrappers/components/ui/multi-select-search-autocomplete/Examples.svelte

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,13 @@
438438
{#snippet Example7()}
439439
<div class="p-5 bg-white space-y-6">
440440
<div>
441-
<h6 class="font-semibold mb-3">Smart Source Selection:</h6>
442-
<p class="text-sm text-gray-600 mb-4">
441+
<h6 class="govuk-heading-s">Smart Source Selection:</h6>
442+
<p class="govuk-body">
443443
This example demonstrates how to use the <code>sourceSelector</code> prop
444444
to intelligently choose between API and static options based on the search
445445
query. Try searching for:
446446
</p>
447-
<ul class="text-sm text-gray-600 list-disc list-inside mb-4 space-y-1">
447+
<ul class="govuk-list govuk-list--bullet">
448448
<li>
449449
<strong>Postcodes</strong> (e.g., "SW1A 1AA", "M1", "B1") → Uses API
450450
</li>
@@ -526,23 +526,20 @@
526526

527527
// If it looks like a postcode (even partial), use API
528528
if (isLikelyPostcode(q)) {
529-
console.log("🎯 Query looks like postcode, using API:", q);
529+
console.log("Query looks like postcode, using API:", q);
530530
return "api";
531531
}
532532

533533
// For everything else, use static options
534-
console.log(
535-
"🎯 Query is not postcode-like, using static options:",
536-
q,
537-
);
534+
console.log("Query is not postcode-like, using static options:", q);
538535
return "options";
539536
}}
540537
/>
541538
</div>
542539

543-
<div class="bg-blue-50 p-4 rounded-lg">
544-
<h6 class="font-semibold mb-2 text-blue-800">How it works:</h6>
545-
<div class="text-sm text-blue-700 space-y-2">
540+
<div class="govuk-inset-text">
541+
<h6 class="govuk-heading-s govuk-!-margin-top-0">How it works:</h6>
542+
<div class="govuk-body">
546543
<p>
547544
<strong>sourceSelector</strong> is a function that receives the search
548545
query and available static options, then returns either "api" or "options"
@@ -551,7 +548,7 @@
551548
<p>
552549
<strong>Priority order:</strong>
553550
</p>
554-
<ol class="list-decimal list-inside ml-4 space-y-1">
551+
<ol class="govuk-list govuk-list--number">
555552
<li>Below <code>minLength</code> → "short" mode (no search)</li>
556553
<li>
557554
Your <code>sourceSelector</code> function → "api" or "options"
@@ -562,12 +559,14 @@
562559
This gives you full control over when to use API vs static options
563560
while maintaining the existing fallback behavior for edge cases.
564561
</p>
565-
<p class="mt-3 p-2 bg-blue-100 rounded">
566-
<strong>🎯 Smart Postcode Detection:</strong> The example uses robust UK
567-
postcode patterns that can detect both complete postcodes (e.g., "SW1A
568-
1AA") and partial ones (e.g., "SW1", "M1A") as users type, automatically
569-
switching to API mode for postcode-like queries and static options for
570-
everything else.
562+
<p
563+
class="govuk-!-margin-top-4 govuk-!-padding-3 govuk-body govuk-!-font-weight-bold"
564+
>
565+
<strong>Smart Postcode Detection:</strong> The example uses robust UK postcode
566+
patterns that can detect both complete postcodes (e.g., "SW1A 1AA") and
567+
partial ones (e.g., "SW1", "M1A") as users type, automatically switching
568+
to API mode for postcode-like queries and static options for everything
569+
else.
571570
</p>
572571
</div>
573572
</div>

src/wrappers/components/ui/multi-select-search-autocomplete/codeBlocks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,12 @@ export const codeBlock7 = `
395395
396396
// If it looks like a postcode (even partial), use API
397397
if (isLikelyPostcode(q)) {
398-
console.log("🎯 Query looks like postcode, using API:", q);
398+
console.log("Query looks like postcode, using API:", q);
399399
return "api";
400400
}
401401
402402
// For everything else, use static options
403-
console.log("🎯 Query is not postcode-like, using static options:", q);
403+
console.log("Query is not postcode-like, using static options:", q);
404404
return "options";
405405
}}
406406
/>`;

0 commit comments

Comments
 (0)