Skip to content

Commit

Permalink
Add tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
SirMorfield committed Aug 1, 2023
1 parent 49c7127 commit 2c6dcab
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@lucia-auth/adapter-postgresql": "^1.0.1",
"@neoconfetti/svelte": "^1.0.0",
"@playwright/test": "^1.34.0",
"@svelte-plugins/tooltips": "^0.1.6",
"@sveltejs/kit": "^1.18.0",
"@tailwindcss/typography": "^0.5.9",
"@types/cookie": "^0.5.1",
Expand Down
7 changes: 7 additions & 0 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion frontend/src/lib/components/Form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<script lang="ts">
import { enhance } from '$app/forms'
import Button from './Button.svelte'
// @ts-ignore
import { Tooltip } from '@svelte-plugins/tooltips'
export let fields: Field[]
let valueChanged = false
Expand Down Expand Up @@ -40,7 +42,14 @@
on:input={() => (valueChanged = true)} />
{/each}
<br />
<Button type="submit" enabled={valueChanged}>Update</Button>

{#if valueChanged}
<Button type="submit" enabled={valueChanged}>Update</Button>
{:else}
<Tooltip theme="tooltips" content="No changes to submit">
<Button type="submit" enabled={valueChanged}>Update</Button>
</Tooltip>
{/if}
</form>

{#if !valueChanged}
Expand Down

0 comments on commit 2c6dcab

Please sign in to comment.