Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/comp/util/GroupSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
import { createEventDispatcher } from "svelte"
import Select from "svelte-select"

export let items: unknown[]
export let items: { value: string; label: string }[]
export let selected: unknown[] | null
export let hideInput: boolean = false
export let disabled: boolean = false
export let placeholder: string = "Other …"

const dispatch = createEventDispatcher()

function handleSelect(event: CustomEvent) {
function handleSelect(event: CustomEvent<typeof items[number] | null>) {
dispatch("select", event.detail)
}
</script>
Expand Down Expand Up @@ -45,7 +44,9 @@
--multiSelectPadding: theme("padding.0") theme("padding.2");
--inputFontSize: theme("fontSize.base");
--inputLeft: theme("spacing.1");
@apply text-white font-bold;

@apply text-white;
@apply font-bold;
}

.wrapper :global(input) {
Expand Down Expand Up @@ -77,7 +78,9 @@
.wrapper:not(.hideInput)
:global(.selectContainer .multiSelectItem + input) {
border-left: 2px solid theme("colors.primary.DEFAULT");
@apply rounded-none pl-2;

@apply rounded-none;
@apply pl-2;
}

.wrapper :global(.selectContainer.focused input),
Expand Down
37 changes: 37 additions & 0 deletions src/routes/profile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import type { Language } from "../types/generated/graphql"
import { query } from "@urql/svelte"

import SvelteSelect from "svelte-select"

import {
currentUser,
username,
Expand Down Expand Up @@ -290,6 +292,41 @@
?.englishName}:
</label>
<div>
<SvelteSelect
placeholder="Your level …"
items={[
{ value: "", label: "Please select …" },
{
value: CefrLevel.A1,
label: "A1 – Beginner",
},
{
value: CefrLevel.A2,
label: "A2 – Elementary",
},
{
value: CefrLevel.B1,
label: "B1 – Intermediate",
},
{
value: CefrLevel.B2,
label: "B2 – Upper intermediate",
},
{
value: CefrLevel.C1,
label: "C1 – Advanced",
},
{
value: CefrLevel.C2,
label: "C2 – Proficient",
},
]}
selectedValue={learningLevels[code]}
on:select={(event) =>
(learningLevels[code] =
event.detail.value)}
isMulti={false}
/>
<select
id={`level_${code}`}
bind:value={learningLevels[code]}
Expand Down