[O] Disable on tested

pull/131/head
Azalea 2025-03-20 06:05:46 -04:00
parent 182c3ba393
commit c6af5b7d87
2 changed files with 8 additions and 6 deletions

View File

@ -4,13 +4,15 @@
export let placeholder: string export let placeholder: string
export let flex: number = 60 export let flex: number = 60
export let disabled: boolean = false
export let validate: (value: string) => boolean = () => true export let validate: (value: string) => boolean = () => true
</script> </script>
<div class="field" style="flex: {flex}"> <div class="field" style="flex: {flex}">
<label for={desc}>{desc}</label> <label for={desc}>{desc}</label>
<input type="text" placeholder={placeholder} bind:value={value} id="{desc}" on:change <input type="text" placeholder={placeholder} bind:value={value} id="{desc}" on:change
class:error={value && !validate(value)}/> class:error={value && !validate(value)} {disabled}/>
</div> </div>
<style lang="sass"> <style lang="sass">

View File

@ -16,21 +16,21 @@
<!-- First input line --> <!-- First input line -->
<div class="inputs"> <div class="inputs">
<InputTextShort desc="Server Address" placeholder="e.g. http://aquadx.hydev.org" <InputTextShort desc="Server Address" placeholder="e.g. http://aquadx.hydev.org"
bind:value={src.dns} on:change validate={v => /^https?:\/\/[a-z0-9.-]+(:\d+)?$/i.test(v)} /> bind:value={src.dns} on:change validate={v => /^https?:\/\/[a-z0-9.-]+(:\d+)?$/i.test(v)} disabled={tested} />
<InputTextShort desc="Keychip ID" placeholder="e.g. A0299792458" <InputTextShort desc="Keychip ID" placeholder="e.g. A0299792458"
bind:value={src.keychip} on:change validate={v => /^[A-Z0-9]{11}$/.test(v)} /> bind:value={src.keychip} on:change validate={v => /^[A-Z0-9]{11}$/.test(v)} disabled={tested} />
</div> </div>
<!-- Second input line --> <!-- Second input line -->
<div class="inputs"> <div class="inputs">
<div class="game-version"> <div class="game-version">
<InputTextShort desc="Game" placeholder="e.g. SDHD" <InputTextShort desc="Game" placeholder="e.g. SDHD"
bind:value={gameInfo.game} on:change /> bind:value={gameInfo.game} on:change disabled={tested} />
<InputTextShort desc="Version" placeholder="e.g. 2.30" <InputTextShort desc="Version" placeholder="e.g. 2.30"
bind:value={gameInfo.version} on:change /> bind:value={gameInfo.version} on:change disabled={tested} />
</div> </div>
<InputTextShort desc="Card Number" placeholder="e.g. 27182818284590452353" <InputTextShort desc="Card Number" placeholder="e.g. 27182818284590452353"
bind:value={src.card} on:change /> bind:value={src.card} on:change disabled={tested} />
</div> </div>
<!-- Buttons --> <!-- Buttons -->