mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
Link component
This commit is contained in:
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>
|
||||
Reference in New Issue
Block a user