mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
Link component
This commit is contained in:
parent
be952ba2da
commit
39c599d2de
1 changed files with 37 additions and 0 deletions
37
v2/test/kitchensink/frontend/src/components/Link.svelte
Normal file
37
v2/test/kitchensink/frontend/src/components/Link.svelte
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<script>
|
||||
import runtime from '@wails/runtime';
|
||||
import { darkMode } from '../Store';
|
||||
|
||||
export let href;
|
||||
|
||||
$: linkclass = darkMode ? 'dark' : 'light';
|
||||
|
||||
function openLink() {
|
||||
runtime.Browser.OpenURL(href);
|
||||
}
|
||||
</script>
|
||||
|
||||
<span class="link {linkclass}" on:click="{openLink}"><slot></slot></span>
|
||||
|
||||
<style>
|
||||
|
||||
.link {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.link.dark:hover {
|
||||
color: #ff8bfb;
|
||||
}
|
||||
|
||||
.link.dark {
|
||||
color: #ff8bfb88;
|
||||
}
|
||||
|
||||
.link.light {
|
||||
color: #5c5cff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue