Skip to content

Commit 50b9a3c

Browse files
update title rendering in project pages
1 parent 418d498 commit 50b9a3c

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

src/routes/projects/[projectName]/+page.svelte

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@
1313
// alwaysShowTracks: false
1414
// });
1515
let data = await getData();
16-
project = [...data.projectsPage?.engineeringProjects!, ...data.projectsPage?.programmingProjects!].find(
16+
project = [
17+
...data.projectsPage?.engineeringProjects!,
18+
...data.projectsPage?.programmingProjects!
19+
].find(
1720
(p) =>
1821
p.name?.trim().replaceAll(' ', '-') ===
1922
$page.params.projectName.trim().replaceAll(' ', '-')
2023
);
21-
project?.description?.subheadings?.forEach((s) => {s.showSubHeadings = true})
24+
project?.description?.subheadings?.forEach((s) => {
25+
s.showSubHeadings = true;
26+
});
2227
});
2328
$: console.log(project);
2429
</script>
@@ -36,12 +41,18 @@
3641
<p class="relative text-left text-xl pl-[12.5%]">{project.description?.overview}</p>
3742
</div>
3843
{#each project.description?.subheadings || [] as subHeading}
39-
<div class="relative left-[12.5%] w-[75%] mt-[2%] mb-[2%] {subHeading.border ? 'border-b' : ''} pb-[2%] border-slate-500">
40-
<h1
41-
class="relative text-3xl mt-[2%] font-semi-bold text-sky-500 mb-2 text-left underline"
42-
>
43-
{subHeading.title || ''}
44-
</h1>
44+
<div
45+
class="relative left-[12.5%] w-[75%] mt-[2%] mb-[2%] {subHeading.border
46+
? 'border-b'
47+
: ''} pb-[2%] border-slate-500"
48+
>
49+
{#if subHeading.title}
50+
<h1
51+
class="relative text-3xl mt-[2%] font-semi-bold text-sky-500 mb-2 text-left underline"
52+
>
53+
{subHeading.title || ''}
54+
</h1>
55+
{/if}
4556
{#if subHeading.html}
4657
{@html subHeading.content}
4758
{:else}
@@ -56,7 +67,9 @@
5667
on:click={() => {
5768
subHeading.showSubHeadings = !subHeading.showSubHeadings;
5869
}}
59-
class="w-fit absolute right-[12.5%] top-[2%] text-slate-400 hover:text-sky-500 transition-all duration-200 {subHeading.subheadings ? '' : 'hidden'}"
70+
class="w-fit absolute right-[12.5%] top-[2%] text-slate-400 hover:text-sky-500 transition-all duration-200 {subHeading.subheadings
71+
? ''
72+
: 'hidden'}"
6073
>
6174
{#if subHeading.showSubHeadings}
6275
<svg
@@ -92,15 +105,17 @@
92105
</button>
93106
{#each subHeading.subheadings || [] as subsubHeading}
94107
<div
95-
class="relative left-[12.5%] w-[75%] mt-[2%] mb-[2%] border-slate-500 pb-[2%] {subsubHeading.border ? 'border-b' : ''} {subHeading.showSubHeadings
96-
? ''
97-
: 'hidden'}"
108+
class="relative left-[12.5%] w-[75%] mt-[2%] mb-[2%] border-slate-500 pb-[2%] {subsubHeading.border
109+
? 'border-b'
110+
: ''} {subHeading.showSubHeadings ? '' : 'hidden'}"
98111
>
99-
<h1
100-
class="relative text-3xl mt-[2%] font-semi-bold text-sky-500 mb-2 text-left underline"
101-
>
102-
{subsubHeading.title || ''}
103-
</h1>
112+
{#if subsubHeading.title}
113+
<h1
114+
class="relative text-3xl mt-[2%] font-semi-bold text-sky-500 mb-2 text-left underline"
115+
>
116+
{subsubHeading.title || ''}
117+
</h1>
118+
{/if}
104119
{#if subsubHeading.html}
105120
{@html subsubHeading.content}
106121
{:else}

0 commit comments

Comments
 (0)