chore: reduce question title size

This commit is contained in:
Rotimi Best
2024-08-03 14:20:20 +01:00
parent 77dcbe078c
commit e8de6b9457
7 changed files with 51 additions and 51 deletions
@@ -7,22 +7,24 @@
import Grade from '$lib/components/Question/Grade.svelte';
import { t } from '$lib/utils/functions/translations';
import ReasonBox from '../ReasonBox.svelte';
import { course } from '$lib/components/Course/store';
import { COURSE_TYPE } from '$lib/utils/types';
import QuestionTitle from '../QuestionTitle.svelte';
export let title = '';
export let index = 1;
export let code;
export let name = '';
export let options = [];
export let onSubmit = () => {};
export let options: { value: string; label: string }[] = [];
export let onSubmit = (a: string, b: string[]) => {};
export let onPrevious = () => {};
export let defaultValue = [];
export let defaultValue: string[] = [];
export let disablePreviousButton = false;
export let isLast = false;
export let disabled = false;
export let isPreview = false;
export let nextButtonProps = {};
export let nextButtonProps = {
isDisabled: false,
isActive: false
};
export let grade: number | undefined;
export let gradeMax = 0;
export let disableGrading = false;
@@ -34,7 +36,7 @@
let gradeWithAI = false;
function getVal(form, name) {
let values = [];
let values: string[] = [];
const checkboxEl = form.elements[name];
for (let i = 0, len = checkboxEl.length; i < len; i++) {
@@ -77,21 +79,15 @@
gradeWithAI = false;
grade = 0;
}
$: {
gradeWithAI = isGradeWithAI;
}
$: gradeWithAI = isGradeWithAI;
</script>
<form on:submit|preventDefault={handleFormSubmit}>
<div class="flex items-center justify-between">
<HtmlRender className="mt-4">
<HtmlRender className="mt-4 {typeof grade === 'number' && 'w-4/5'}" disableMaxWidth>
<svelte:fragment slot="content">
<span class={`${typeof grade === 'number' ? 'w-3/4' : ''} flex gap-1`}>
<h3>{index}</h3>
<h3>
{title}
</h3>
</span>
<QuestionTitle {index} {title} />
</svelte:fragment>
</HtmlRender>
{#if !hideGrading}
@@ -0,0 +1,9 @@
<script lang="ts">
export let index: number;
export let title: string;
</script>
<span class="flex gap-2">
<p class="text-md font-medium">{index}</p>
<p class="text-md font-medium">{title}</p>
</span>
@@ -7,26 +7,27 @@
import Grade from '$lib/components/Question/Grade.svelte';
import { t } from '$lib/utils/functions/translations';
import ReasonBox from '../ReasonBox.svelte';
import { COURSE_TYPE } from '$lib/utils/types';
import { course } from '$lib/components/Course/store';
import QuestionTitle from '../QuestionTitle.svelte';
export let title = '';
export let index = 1;
export let code = '';
export let name = '';
export let options = [];
export let onSubmit = () => {};
export let options: { value: string; label: string; is_correct: boolean }[] = [];
export let onSubmit = (a: string, b: string[]) => {};
export let onPrevious = () => {};
export let defaultValue = '';
export let disablePreviousButton = false;
export let disabled = false;
export let isPreview = false;
export let nextButtonProps = {};
export let nextButtonProps = {
isDisabled: false,
isActive: false
};
export let isLast = false;
export let grade: number;
export let gradeMax = 0;
export let disableGrading = false;
export let labelClassName = '';
export let disableOptContainerMargin = false;
export let isGradeWithAI = false;
export let reason;
@@ -35,7 +36,7 @@
let gradeWithAI = false;
function getRadioVal(form, name) {
function getRadioVal(form, name): string {
let val;
const radios = form.elements[name];
@@ -80,19 +81,14 @@
grade = 0;
}
$: {
gradeWithAI = isGradeWithAI;
}
$: gradeWithAI = isGradeWithAI;
</script>
<form on:submit|preventDefault={handleFormSubmit}>
<div class="flex items-center justify-between">
<HtmlRender className="mt-4">
<HtmlRender className="mt-4 {typeof grade === 'number' && 'w-4/5'}" disableMaxWidth>
<svelte:fragment slot="content">
<span class="dark:text-white flex items-center gap-1 {labelClassName}">
<h3>{index}</h3>
<h3>{title}</h3>
</span>
<QuestionTitle {index} {title} />
</svelte:fragment>
</HtmlRender>
{#if !hideGrading}
@@ -7,14 +7,13 @@
import Grade from '$lib/components/Question/Grade.svelte';
import { t } from '$lib/utils/functions/translations';
import ReasonBox from '../ReasonBox.svelte';
import { course } from '$lib/components/Course/store';
import { COURSE_TYPE } from '$lib/utils/types';
import QuestionTitle from '../QuestionTitle.svelte';
export let title = '';
export let index = 1;
export let code = '';
export let name = '';
export let onSubmit = () => {};
export let onSubmit = (a: string, b: string) => {};
export let onPrevious = () => {};
export let defaultValue = '';
export let disablePreviousButton = false;
@@ -51,19 +50,14 @@
grade = 0;
}
$: {
gradeWithAI = isGradeWithAI;
}
$: gradeWithAI = isGradeWithAI;
</script>
<form on:submit|preventDefault={handleFormSubmit}>
<div class="flex items-center justify-between mb-2">
<HtmlRender className="mt-4">
<HtmlRender className="mt-4 {typeof grade === 'number' && 'w-4/5'}" disableMaxWidth>
<svelte:fragment slot="content">
<span class={`${typeof grade === 'number' ? 'w-3/4' : ''} flex gap-1`}>
<h3>{index}</h3>
<h3>{title}</h3>
</span>
<QuestionTitle {index} {title} />
</svelte:fragment>
</HtmlRender>
{#if !hideGrading}
@@ -88,7 +82,7 @@
{:else}
<TextArea
bind:value={defaultValue}
rows="5"
rows={5}
placeholder={$t('course.navItem.lessons.exercises.all_exercises.write_your_answer_here')}
/>
{/if}