Implement 'internal submit button' to the 'Textbox' component. Remove separate submit to the Headcode search card.

Adjust the hover and active styles of the 'TrainService' expandable cards.
This commit is contained in:
2026-05-05 15:55:51 +01:00
parent 6a857c2d64
commit 3b91fad590
3 changed files with 85 additions and 16 deletions

View File

@@ -6,8 +6,7 @@
let headcode = $state('');
function handleSearch(e: SubmitEvent) {
e.preventDefault();
function handleSearch(headcode: string) {
if (!headcode.trim()) return;
const searchParams = new URLSearchParams();
@@ -18,10 +17,9 @@
</script>
<BaseCard header={'Search Train & PIS'}>
<form onsubmit={handleSearch} class="card-content">
<Textbox placeholder="Enter Headcode" bind:value={headcode} maxLength={4} />
<Button type="submit" disabled={!headcode}>Search</Button>
</form>
<div class="card-content">
<Textbox placeholder="Enter Headcode" bind:value={headcode} maxLength={4} onsubmit={handleSearch} />
</div>
</BaseCard>
<style>
@@ -29,7 +27,7 @@
text-align: center;
width: 90%;
margin: auto;
padding: 10px 0 0 0;
padding: 10px 0 0.5rem 0;
display: flex;
flex-direction: column;
gap: 0.75rem;