<script lang="ts">
	import Button from "$lib/components/ui/Button.svelte";
	import Input from "$lib/components/ui/Input.svelte";
	import DrillDown from "$lib/components/settings/DrillDown.svelte";
	import SettingsList from "$lib/components/settings/SettingsList.svelte";
	import FormRow from "$lib/components/settings/FormRow.svelte";
	import FormActions from "$lib/components/settings/FormActions.svelte";
	import Key from "$icon/key";
	import X from "$icon/x";

	let password = $state("");
	const valid = $derived(password.length > 0);
</script>

<DrillDown backLabel="Profile" backHref="/settings" title="Change password">
	<SettingsList padding="tight">
		<FormRow
			label="Current password"
			description="Confirm your identity to proceed."
			for="current-password"
		>
			<Input id="current-password" type="password" bind:value={password} />
		</FormRow>
	</SettingsList>

	<FormActions>
		<Button href="/settings" icon={X}>Cancel</Button>
		<!-- mocked — the reset mail is sent by the G4 account service -->
		<Button variant="primary" icon={Key} disabled={!valid}>Send reset code</Button>
	</FormActions>
</DrillDown>
