|
|
@ -1,13 +1,9 @@ |
|
|
|
--- |
|
|
|
--- |
|
|
|
import { |
|
|
|
import { getGuideTableOfContent, type HeadingGroupType } from '../../lib/guide'; |
|
|
|
getGuideTableOfContent, |
|
|
|
|
|
|
|
type GuideFileType, |
|
|
|
|
|
|
|
HeadingGroupType, |
|
|
|
|
|
|
|
} from '../../lib/guide'; |
|
|
|
|
|
|
|
import MarkdownFile from '../MarkdownFile.astro'; |
|
|
|
import MarkdownFile from '../MarkdownFile.astro'; |
|
|
|
import { TableOfContent } from '../TableOfContent/TableOfContent'; |
|
|
|
import { TableOfContent } from '../TableOfContent/TableOfContent'; |
|
|
|
import { markdownToHtml, replaceVariables } from '../../lib/markdown'; |
|
|
|
import { markdownToHtml, replaceVariables } from '../../lib/markdown'; |
|
|
|
import { QuestionGroupType } from '../../lib/question-group'; |
|
|
|
import type { QuestionGroupType } from '../../lib/question-group'; |
|
|
|
import { QuestionsList } from './QuestionsList'; |
|
|
|
import { QuestionsList } from './QuestionsList'; |
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
interface Props { |
|
|
@ -16,19 +12,17 @@ interface Props { |
|
|
|
|
|
|
|
|
|
|
|
const { questionGroup } = Astro.props; |
|
|
|
const { questionGroup } = Astro.props; |
|
|
|
|
|
|
|
|
|
|
|
const allHeadings = questionGroup.getHeadings(); |
|
|
|
const { headings: allHeadings, Content } = await questionGroup.render(); |
|
|
|
const tableOfContent: HeadingGroupType[] = [ |
|
|
|
const tableOfContent: HeadingGroupType[] = [ |
|
|
|
...getGuideTableOfContent(allHeadings), |
|
|
|
...getGuideTableOfContent(allHeadings), |
|
|
|
{ |
|
|
|
{ |
|
|
|
depth: 2, |
|
|
|
depth: 2, |
|
|
|
title: 'Test with Flashcards', |
|
|
|
text: 'Test yourself with Flashcards', |
|
|
|
children: [], |
|
|
|
children: [], |
|
|
|
slug: 'test-with-flashcards', |
|
|
|
slug: 'test-with-flashcards', |
|
|
|
text: 'Test yourself with Flashcards', |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
depth: 2, |
|
|
|
depth: 2, |
|
|
|
title: 'Questions List', |
|
|
|
|
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
depth: 2, |
|
|
|
depth: 2, |
|
|
@ -58,7 +52,7 @@ const tableOfContent: HeadingGroupType[] = [ |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
const showTableOfContent = tableOfContent.length > 0; |
|
|
|
const showTableOfContent = tableOfContent.length > 0; |
|
|
|
const { frontmatter: guideFrontmatter, author } = questionGroup; |
|
|
|
const { data: guideFrontmatter, author } = questionGroup; |
|
|
|
--- |
|
|
|
--- |
|
|
|
|
|
|
|
|
|
|
|
<article class='lg:grid lg:max-w-full lg:grid-cols-[1fr_minmax(0,700px)_1fr]'> |
|
|
|
<article class='lg:grid lg:max-w-full lg:grid-cols-[1fr_minmax(0,700px)_1fr]'> |
|
|
@ -90,11 +84,11 @@ const { frontmatter: guideFrontmatter, author } = questionGroup; |
|
|
|
class='inline-flex items-center font-medium underline-offset-2 hover:text-gray-600 hover:underline' |
|
|
|
class='inline-flex items-center font-medium underline-offset-2 hover:text-gray-600 hover:underline' |
|
|
|
> |
|
|
|
> |
|
|
|
<img |
|
|
|
<img |
|
|
|
alt={author.frontmatter.name} |
|
|
|
alt={author.data.name} |
|
|
|
src={author.frontmatter.imageUrl} |
|
|
|
src={author.data.imageUrl} |
|
|
|
class='mb-0 mr-2 inline h-5 w-5 rounded-full' |
|
|
|
class='mb-0 mr-2 inline h-5 w-5 rounded-full' |
|
|
|
/> |
|
|
|
/> |
|
|
|
{author.frontmatter.name} |
|
|
|
{author.data.name} |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
<span class='mx-2 hidden sm:inline'>·</span> |
|
|
|
<span class='mx-2 hidden sm:inline'>·</span> |
|
|
|
<a |
|
|
|
<a |
|
|
@ -107,7 +101,7 @@ const { frontmatter: guideFrontmatter, author } = questionGroup; |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
<questionGroup.Content /> |
|
|
|
<Content /> |
|
|
|
|
|
|
|
|
|
|
|
<h2 id='test-with-flashcards'>Test yourself with Flashcards</h2> |
|
|
|
<h2 id='test-with-flashcards'>Test yourself with Flashcards</h2> |
|
|
|
<p> |
|
|
|
<p> |
|
|
@ -136,8 +130,8 @@ const { frontmatter: guideFrontmatter, author } = questionGroup; |
|
|
|
</h3> |
|
|
|
</h3> |
|
|
|
{questionGroup.questions |
|
|
|
{questionGroup.questions |
|
|
|
.filter((q) => { |
|
|
|
.filter((q) => { |
|
|
|
return q.topics |
|
|
|
return q?.topics |
|
|
|
.map((t) => t.toLowerCase()) |
|
|
|
?.map((t) => t.toLowerCase()) |
|
|
|
.includes(questionLevel); |
|
|
|
.includes(questionLevel); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.map((q) => ( |
|
|
|
.map((q) => ( |
|
|
|