-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
497a40e
commit 5b670a2
Showing
11 changed files
with
248 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<script lang="ts"> | ||
import { open } from "@tauri-apps/api/shell"; | ||
import Toggle from "../../interactables/Toggle.svelte"; | ||
export let label = ""; | ||
export let description = ""; | ||
export let value: boolean; | ||
export let onChange: (value: boolean) => void = () => {}; | ||
/** | ||
* Handles click events to redirect to the browser. | ||
* @param e The click event. | ||
*/ | ||
function clickListener(e: Event): void { | ||
const origin = (e.target as Element).closest("a"); | ||
if (origin) { | ||
e.preventDefault(); | ||
const href = origin.href; | ||
open(href); | ||
} | ||
} | ||
</script> | ||
|
||
<div class="setting"> | ||
<div class="inputs"> | ||
<Toggle label={label} onChange={onChange} bind:value={value} /> | ||
</div> | ||
{#if description !== ""} | ||
<!-- svelte-ignore a11y-click-events-have-key-events --> | ||
<div class="description" on:click={clickListener}> | ||
<!-- eslint-disable-next-line svelte/no-at-html-tags --> | ||
{@html description}<br/> | ||
</div> | ||
{/if} | ||
</div> | ||
|
||
<style> | ||
.setting { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
margin: 0px 14px; | ||
background-color: var(--background-dark); | ||
padding: 6px; | ||
border-radius: 4px; | ||
width: calc(100% - 42px); | ||
} | ||
.description { | ||
line-height: 18px; | ||
font-size: 14px; | ||
margin: 7px 0px; | ||
} | ||
.inputs { | ||
display: flex; | ||
align-items: center; | ||
} | ||
</style> |
Oops, something went wrong.