Files
classroomio/src/routes/ask.svelte
T

97 lines
2.5 KiB
Svelte
Raw Normal View History

2021-01-21 22:23:23 +02:00
<script>
2020-12-30 22:29:01 +02:00
import ChevronDown24 from "carbon-icons-svelte/lib/ChevronDown24";
2021-04-05 07:12:51 +03:00
import TextEditor from "../components/TextEditor.svelte";
2020-12-30 22:29:01 +02:00
2021-04-05 07:12:51 +03:00
let questionTitle = "";
let questionDescription = "";
2021-01-21 22:23:23 +02:00
let facultyFilterOpened = false;
2020-12-30 22:29:01 +02:00
const faculties = [
2021-04-05 07:12:51 +03:00
"ИЭКСУ",
"ИМБТ",
"ИМИ",
"ИПТДМ",
"ИИИР",
"ГФ",
"ХТФ",
"ИДЗО",
"УИИ",
"УНИ",
2020-12-30 22:29:01 +02:00
];
2021-01-21 22:23:23 +02:00
let checkbox = faculties.reduce((acc, cur) => {
acc[cur] = false;
return acc;
}, {});
2021-04-05 07:12:51 +03:00
$: clickedTotal = Object.values(checkbox).filter((box) => !!box).length;
2021-01-21 22:23:23 +02:00
function handleFacultyFilters() {
facultyFilterOpened = facultyFilterOpened ? false : true;
}
2020-12-30 22:29:01 +02:00
</script>
2020-12-24 20:32:05 +02:00
<svelte:head>
2021-04-05 07:12:51 +03:00
<title>Спросить собшество вопрос</title>
2020-12-24 20:32:05 +02:00
</svelte:head>
2020-12-30 22:29:01 +02:00
<div class="lg:w-3/5 mx-auto md:mx-10 lg:mb-20">
<h2 class="pb-2">Спросить собшество вопрос</h2>
2021-04-05 07:12:51 +03:00
<div class="main-title my-1 flex">
<div class="faculty-filter mr-1">
2021-01-21 22:23:23 +02:00
<button
class="flex border rounded-lg border-grey py-2 px-3 focus:outline-none focus:border-gray-400 focus:bg-gray-200 relative"
on:click={handleFacultyFilters}
>
2021-04-05 07:12:51 +03:00
<span class="flex flex-row"
>Факултеты <span>&nbsp;({clickedTotal})</span></span
>
<ChevronDown24 class="ml-2" />
2021-01-21 22:23:23 +02:00
</button>
{#if facultyFilterOpened}
2021-04-05 07:12:51 +03:00
<div
class="w-48 bg-white border border-grey rounded-lg mt-2 py-2 absolute"
>
2021-01-21 22:23:23 +02:00
{#each faculties as faculty}
<div class="block px-4 py-2 border-b">
<input
type="checkbox"
class="border border-gray checked:bg-blue-600 checked:border-transparent mr-1 cursor-pointer"
bind:checked={checkbox[faculty]}
2021-04-05 07:12:51 +03:00
/>
2021-01-21 22:23:23 +02:00
<span>{faculty}</span>
</div>
{/each}
2020-12-30 22:29:01 +02:00
</div>
2021-01-21 22:23:23 +02:00
{/if}
2020-12-30 22:29:01 +02:00
</div>
<input
2021-01-02 01:23:32 +02:00
class="title rounded-lg border border-1 border-gray p-2 w-full focus:outline-none"
2020-12-30 22:29:01 +02:00
error="false"
autocomplete="off"
placeholder="Title"
aria-label="Title"
aria-describedby="title-input-validation"
type="text"
name="discussion[title]"
id="discussion_title"
2021-04-05 07:12:51 +03:00
value={questionTitle}
/>
2020-12-30 22:29:01 +02:00
</div>
2020-12-24 20:32:05 +02:00
2020-12-30 22:29:01 +02:00
<TextEditor
2021-04-05 07:12:51 +03:00
value={questionDescription}
2020-12-30 22:29:01 +02:00
placeholder="Задайте вопрос или начните разговор"
/>
2021-04-05 07:12:51 +03:00
</div>
<style>
@media only screen and (max-width: 1002px) {
.faculty-filter {
margin-bottom: 10px;
}
.main-title {
flex-direction: column;
}
}
</style>