🚸 Fixed wide focus in editor.svelte

This commit is contained in:
Mawoka
2022-04-01 21:36:59 +02:00
parent e39898acdf
commit 3e859c76e4
+43 -43
View File
@@ -1,4 +1,4 @@
<script lang="ts"> <script lang='ts'>
import { getLocalization } from '$lib/i18n'; import { getLocalization } from '$lib/i18n';
const { t } = getLocalization(); const { t } = getLocalization();
@@ -62,82 +62,82 @@
}; };
</script> </script>
<label class="pl-2"> <label class='pl-2 w-2/6 flex gap-2 flex-row'>
<input type="checkbox" class="w-fit" bind:checked={data.public} /> <input type='checkbox' class='w-fit' bind:checked={data.public} />
{$t('words.public')}? <span class='w-fit'>{$t('words.public')}?</span>
</label> </label>
<label class="pl-2"> <label class='pl-2 flex flex-row gap-2 w-3/5'>
{$t('words.title')}: <span class='w-fit'>{$t('words.title')}:</span>
<input <input
type="text" type='text'
placeholder={$t('words.title')} placeholder={$t('words.title')}
bind:value={data.title} bind:value={data.title}
class="text-black w-3/5 bg-inherit border-dotted border-b-2 border-black" class='text-black bg-inherit border-dotted border-b-2 border-black w-full'
/> />
</label> </label>
<label class="pl-2"> <label class='pl-2 flex flex-row gap-2 w-3/5'>
{$t('words.description')}: {$t('words.description')}:
<textarea <textarea
placeholder={$t('words.description')} placeholder={$t('words.description')}
bind:value={data.description} bind:value={data.description}
class="text-black w-3/5" class='text-black w-full'
/> />
</label> </label>
{#each data.questions as question, index_question} {#each data.questions as question, index_question}
<div class="ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2"> <div class='ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2'>
<h1 class="text-3xl m-1">{$t('words.question')} {index_question + 1}</h1> <h1 class='text-3xl m-1'>{$t('words.question')} {index_question + 1}</h1>
<label class="m-1"> <label class='m-1 flex flex-row gap-2 w-3/5'>
{$t('words.question')}: {$t('words.question')}:
<input <input
type="text" type='text'
placeholder={$t('words.question')} placeholder={$t('words.question')}
bind:value={question.question} bind:value={question.question}
class="text-black w-3/5 bg-inherit border-dotted border-b-2 border-black" class='text-black w-full bg-inherit border-dotted border-b-2 border-black'
/> />
</label> </label>
<label class="m-1"> <label class='m-1 flex flex-row gap-2 w-3/5'>
{$t('words.image')}: {$t('words.image')}:
<input <input
type="text" type='text'
placeholder="https://i.imgur.com/kSPCidY.png" placeholder='https://i.imgur.com/kSPCidY.png'
bind:value={question.image} bind:value={question.image}
class="text-black w-3/5 bg-inherit border-dotted border-b-2 border-black" class='text-black w-full bg-inherit border-dotted border-b-2 border-black'
/> />
</label> </label>
<label class="m-1"> <label class='m-1 flex flex-row gap-2 w-3/5 flex-nowrap whitespace-nowrap'>
{$t('editor.time_in_seconds')}: {$t('editor.time_in_seconds')}:
<input <input
type="text" type='text'
placeholder="20" placeholder='20'
bind:value={question.time} bind:value={question.time}
class="text-black w-3/5 bg-inherit border-dotted border-b-2 border-black" class='text-black w-full bg-inherit border-dotted border-b-2 border-black'
/> />
</label> </label>
{#each question.answers as answer, index_answer} {#each question.answers as answer, index_answer}
<div class="ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2 m-1"> <div class='ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2 m-1'>
<h1 class="text-3xl m-1">{$t('words.answer')} {index_answer + 1}</h1> <h1 class='text-3xl m-1'>{$t('words.answer')} {index_answer + 1}</h1>
<p class="m-1"> <p class='m-1'>
{$t('words.answer')}: {index_answer + 1} {$t('words.answer')}: {index_answer + 1}
{$t('words.question')}: {index_question + 1} {$t('words.question')}: {index_question + 1}
</p> </p>
<label class=" m-1"> <label class='m-1 flex flex-row gap-2 w-3/5 flex-nowrap whitespace-nowrap'>
{$t('words.answer')}: {$t('words.answer')}:
<input <input
type="text" type='text'
placeholder={$t('words.answer')} placeholder={$t('words.answer')}
bind:value={data.questions[index_question].answers[index_answer].answer} bind:value={data.questions[index_question].answers[index_answer].answer}
class="text-black w-3/5 bg-inherit border-dotted border-b-2 border-black" class='text-black w-full bg-inherit border-dotted border-b-2 border-black'
/> />
</label> </label>
<label class="m-1"> <label class='m-1 flex flex-row gap-2 w-2/6 flex-nowrap whitespace-nowrap'>
<input type="checkbox" bind:checked={answer.right} class="text-black" /> <input type='checkbox' bind:checked={answer.right} class='text-black w-fit' />
{$t('editor.right_or_true?')} <span class='w-fit'>{$t('editor.right_or_true?')}</span>
</label> </label>
<button <button
class="text-left border-yellow-500 border-2 w-fit m-1" class='text-left border-yellow-500 border-2 w-fit m-1'
type="button" type='button'
on:click={() => { on:click={() => {
data.questions[index_question].answers.splice(index_answer, 1); data.questions[index_question].answers.splice(index_answer, 1);
data.questions[index_question].answers = data.questions[index_question].answers =
@@ -149,8 +149,8 @@
</div> </div>
{/each} {/each}
<button <button
class="text-left border-green-500 border-2 w-fit m-1" class='text-left border-green-500 border-2 w-fit m-1'
type="button" type='button'
on:click={() => { on:click={() => {
data.questions[index_question].answers = [ data.questions[index_question].answers = [
...data.questions[index_question].answers, ...data.questions[index_question].answers,
@@ -161,8 +161,8 @@
{$t('editor.add_new_answer')} {$t('editor.add_new_answer')}
</button> </button>
<button <button
class="text-left border-red-500 border-2 w-fit m-1" class='text-left border-red-500 border-2 w-fit m-1'
type="button" type='button'
on:click={() => { on:click={() => {
data.questions.splice(index_question, 1); data.questions.splice(index_question, 1);
data.questions = data.questions; data.questions = data.questions;
@@ -173,8 +173,8 @@
</div> </div>
{/each} {/each}
<button <button
class="text-left" class='text-left'
type="button" type='button'
on:click={() => { on:click={() => {
data.questions = [...data.questions, { ...empty_question }]; data.questions = [...data.questions, { ...empty_question }];
}} }}
@@ -182,12 +182,12 @@
{$t('editor.add_new_question')} {$t('editor.add_new_question')}
</button> </button>
{#if imgur_links_valid} {#if imgur_links_valid}
<p class="text-blue-600 text-xl text-center w-fit mx-auto"> <p class='text-blue-600 text-xl text-center w-fit mx-auto'>
Not all links are imgur-links! <!-- TODO: Add translation --> Not all links are imgur-links! <!-- TODO: Add translation -->
</p> </p>
{/if} {/if}
<button <button
type="submit" type='submit'
class="text-xl disabled:cursor-not-allowed disabled:border disabled:border-red-500 w-fit mx-auto" class='text-xl disabled:cursor-not-allowed disabled:border disabled:border-red-500 w-fit mx-auto'
disabled={imgur_links_valid}>{submit_button_text}</button disabled={imgur_links_valid}>{submit_button_text}</button
> >