Skip to content

Commit

Permalink
Merge pull request #68 from fdnd-agency/55-component-checkbox
Browse files Browse the repository at this point in the history
checkbox component #68 #55
  • Loading branch information
christoph3r3w authored Oct 8, 2024
2 parents ffd1c37 + 5aeb8ea commit d6a53f9
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/styles/global.css" rel="stylesheet">
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
Expand Down
59 changes: 59 additions & 0 deletions src/lib/checkbox.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<script>
export let answer; // Het antwoord object dat je doorgeeft
export let bindGroup; // Voor het binden van de groep aan het antwoord
</script>

<label>
<input type="radio" name="answer" value={answer.score} bind:group={bindGroup}>
{answer.answer}
</label>

<style>
label {
background-color: var(--D-base-bk);
border-radius: 1rem;
border: 0.1rem solid var(--D-mid-bk);
display: flex;
flex-direction: row;
align-items: center;
padding: 1rem;
cursor: pointer;
}
label:hover{
background-color: var(--D-t-support);
border: 0.1rem solid var(--D-t-support);
font-weight: 600;
color: var(--D-white);
transition: 2s transform ease-in-out;
}
input[type="radio"] {
-webkit-appearance: none;
appearance: none;
background-color: var(--D-white);
margin: 0 0.5rem 0 0;
font: inherit;
color: var(--D-mid-bk);
width: 1.15rem;
height: 1.15rem;
border: 0.15rem solid var(--D-mid-bk);
border-radius: 50%;
display: grid;
place-content: center;
}
input[type="radio"]::before {
content: "";
width: 0.65rem;
height: 0.65rem;
border-radius: 50%;
transform: scale(0);
transition: 120ms transform ease-in-out;
box-shadow: inset 1rem 1rem var(--D-dark-support);
}
input[type="radio"]:checked::before {
transform: scale(1);
}
</style>
24 changes: 15 additions & 9 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
<script>
export let data;
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
onMount(() => {
goto('/Inlog');
});
import Checkbox from '$lib/checkbox.svelte';
</script>

<h1>{data.person.name}</h1>

<div>
{#each {length: 4} as _, i}
<Checkbox/>
{/each}
</div>


<a href="/inlog">login</a>
<a href="/overview">overzicht</a>
<style>
div {
display: flex;
flex-direction: column;
padding: 1rem;
gap: 1rem;
font-family: Arial, Helvetica, sans-serif;
}
</style>

0 comments on commit d6a53f9

Please sign in to comment.