FCLauncher/fclauncher/frontend/src/Testpage.svelte

120 lines
2.6 KiB
Svelte
Raw Normal View History

<script lang="ts">
2024-11-01 07:44:39 -06:00
import {LaunchInstance} from '../wailsjs/go/main/InstanceManager';
2024-11-01 07:12:40 -06:00
import {instances, loading} from './global'
2024-11-01 05:43:18 -06:00
var testArray = ["test","test2","test3"];
2024-11-01 08:04:52 -06:00
let pack: string = "";
2024-11-01 07:44:39 -06:00
let instance: string
2024-11-01 08:04:52 -06:00
let radio: string = "";
2024-11-01 07:12:40 -06:00
2024-11-01 07:44:39 -06:00
function launchclick(event) {
$loading = true
LaunchInstance(radio).then(() => {
$loading = false
})
}
2024-11-01 07:12:40 -06:00
</script>
<main>
2024-11-01 06:41:52 -06:00
<div class="container">
<div class="tile-group">
2024-11-01 07:44:39 -06:00
{#each $instances as instance}
2024-11-01 06:41:52 -06:00
<div class="input-container">
2024-11-01 07:44:39 -06:00
<input id={instance} bind:group={radio} type="radio" name="radio" value={instance}>
2024-11-01 06:41:52 -06:00
<div class="radio-tile">
<!--icon goes here later-->
2024-11-01 07:44:39 -06:00
<label for={instance}>{instance}</label>
2024-11-01 06:41:52 -06:00
</div>
</div>
{/each}
2024-11-01 07:12:40 -06:00
2024-11-01 06:41:52 -06:00
</div>
2024-11-01 05:43:18 -06:00
</div>
2024-11-01 07:12:40 -06:00
<div class="options-container">
2024-11-01 08:04:52 -06:00
<button class="launch-button" on:click={launchclick}>Launch {radio}</button>
2024-11-01 07:12:40 -06:00
</div>
</main>
<style>
2024-11-01 06:41:52 -06:00
* {
box-sizing: border-box;
font-family: sans-serif;
--text-primary: #b6b6b6;
--text-secondary: #ececec;
--bg-primary: #23232e;
--bg-secondary: #141418;
}
body{
background-color: var(--bg-secondary);
}
2024-11-01 07:12:40 -06:00
main{
display: flex;
flex-direction: row;
justify-content: right;
}
.options-container{
display: flex;
height: 100vh;
width: 20rem;
border: green 2px;
justify-self: right;
justify-content: center;
align-items: center;
}
.launch-button{
height: 3rem;
}
2024-11-01 06:41:52 -06:00
.container{
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
2024-11-01 07:12:40 -06:00
min-width: 70%;
2024-11-01 06:41:52 -06:00
}
.tile-group{
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.input-container{
position: relative;
height: 7rem;
width: 7rem;
margin: 0.5rem;
}
.input-container input{
position: absolute;
height: 100%;
width: 100%;
margin-left: -3.5rem;
z-index: 0;
opacity: 0;
cursor: pointer;
}
.input-container .radio-tile{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
border: 2px solid purple;
border-radius: 8px;
transition: all 300ms ease;
}
.input-container label{
color: purple;
font-size: 1.2rem;
font-weight: 600;
}
input:checked + .radio-tile{
background-color: purple;
box-shadow: 0 0 12px purple;
}
input:hover + .radio-tile{
box-shadow: 0 0 12px purple;
}
input:checked + .radio-tile label{
color: var(--text-primary);
2024-11-01 05:43:18 -06:00
}
</style>