Skip to content

Commit

Permalink
Add page layout updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MathyouMB committed Aug 3, 2024
1 parent 042a528 commit 9aeecb4
Show file tree
Hide file tree
Showing 16 changed files with 301 additions and 285 deletions.
1 change: 1 addition & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export default defineConfig({
},
redirects: {
"/evaluations": "/evaluations/1",
"/" : "/comp2804",
},
});
69 changes: 22 additions & 47 deletions src/components/Pagination/Pagination.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,21 @@ const upperLimit = pagination.totalPages - adjacentLinks;

{
pagination.totalPages > 1 && (
<ul class="pagination">
<ul class="Pagination">
{/* First page */}
{pagination.pageNumber !== 1 && (
<li class="pagination__item pagination__item--first">
<a class="pagination__link pagination__link--first" href={1}>
««
</a>
</li>
)}

{/* Previous page */}
{pagination.hasPrev && (
<li class="pagination__item pagination__item--previous">
<a
href={pagination.prev.url}
class="pagination__link pagination__link--previous"
>
«
</a>
</li>
)}
<li class="Pagination__item pagination__item--first">
<a
class="Pagination__link pagination__link--first"
href={pagination.first.url}
>
<span style="font-size: 1.2rem" class="mdi mdi-page-first" />
</a>
</li>

{/* Page numbers */}
{pagination.pagers.map((page) => {
{pagination.pagers.map((page: any) => {
return (
<Fragment>
<div>
{(() => {
const isInRange =
pagination.totalPages > maxLinks
Expand All @@ -52,42 +41,28 @@ const upperLimit = pagination.totalPages - adjacentLinks;
return (
isInRange && (
<li
class={`pagination__item${page.pageNumber === pagination.pageNumber ? " pagination__item--current" : ""}`}
class={`Pagination__item ${page.pageNumber === pagination.pageNumber ? "Pagination__item--current" : ""}`}
>
<a href={page.url} class="pagination__link">
<a href={page.url} class="Pagination__link">
{page.pageNumber}
</a>
</li>
)
);
})()}
</Fragment>
</div>
);
})}

{/* Next page */}
{pagination.hasNext && (
<li class="pagination__item pagination__item--next">
<a
href={pagination.next.url}
class="pagination__link pagination__link--next"
>
»
</a>
</li>
)}

{/* Last page */}
{pagination.pageNumber !== pagination.totalPages && (
<li class="pagination__item pagination__item--last">
<a
class="pagination__link pagination__link--last"
href={pagination.last.url}
>
»»
</a>
</li>
)}
<li class="Pagination__item pagination__item--last">
<a
class="Pagination__link pagination__link--last"
href={pagination.last.url}
>
<span style="font-size: 1.2rem" class="mdi mdi-page-last" />
</a>
</li>
</ul>
)
}
12 changes: 8 additions & 4 deletions src/components/Pagination/Pagination.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.pagination {
.Pagination {
text-align: center;
font-weight: bold;
display: flex;
justify-content: space-between;
max-width: 10rem;
align-items: center;
max-width: 8rem;
margin: auto;
padding: 0;

Expand All @@ -14,9 +15,12 @@

a {
text-decoration: auto;
color: black;
}

.pagination__item--current {
color: black;
&__item--current {
a {
color: red;
}
}
}
12 changes: 6 additions & 6 deletions src/components/RowCard/RowCard.astro
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
const { href, title, icon, div } = Astro.props;
const { href, title, icon, description } = Astro.props;
import "./RowCard.scss";
---

<div class="RowCard">
<div class="RowCard__section">
<div class="RowCard__icon"><i class={icon}></i></div>
<div class="RowCard__title"><h4>{title}</h4></div>
<div class="RowCard__text">
<div class="RowCard__title">{title}</div>

{description && <div class="RowCard__description">{description}</div>}
</div>
</div>
<!-- <div class="RowCard__section">
<div class="RowCard__icon"><i class={"mdi mdi-book-open-variant"}></i></div>
<div class="RowCard__icon"><i class={icon}></i></div>
</div> -->
</div>
17 changes: 17 additions & 0 deletions src/components/RowCard/RowCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,25 @@
transition: all 0.2s;
margin-left: -0.8rem;
margin-right: -0.8rem;
height: 4rem;
cursor: grab;

&__text {
display: flex;
flex-direction: column;
gap: 0.2rem;
}

&__title {
font-size: 1.1rem;
font-weight: bold;
}

&__description {
font-size: 0.8rem;
color: #717171d5;
}

&:hover {
background-color: rgba(248, 248, 248, 0.753);
.RowCard__icon {
Expand Down
61 changes: 34 additions & 27 deletions src/components/Sidebar/Sidebar.astro
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
---
import SidebarItem from "./SidebarItem.astro";
import "./Sidebar.scss";
// mdi mdi-file-document-multiple-outline
// mdi mdi-bookmark-box-multiple-outline
const sections = [
{ icon: "mdi mdi-home", title: "Home", disabled: false, link: "/" },
{
icon: "mdi mdi-book-open-variant",
title: "Evaluations",
disabled: false,
link: "/evaluations",
},
{
icon: "mdi mdi-school",
title: "Courses",
disabled: false,
link: "/courses",
},
{
icon: "mdi mdi-tag",
title: "Tags",
disabled: false,
link: "/practice-by-tag",
},
// {
// icon: "mdi mdi-book",
// title: "Textbook",
// disabled: false,
// link: "https://patmorin.me/teaching/2804/resources/DiscreteStructures.pdf",
// },
{
icon: "mdi mdi-video",
title: "Lectures",
disabled: false,
link: "https://www.youtube.com/playlist?list=PLY7TEz3ZRQHTnY56q2uJtdXg-bl-c0sDk",
},
{ icon: "mdi mdi-creation", title: "Sandbox", disabled: true },
// { icon: "mdi mdi-beaker", title: "Experiments", disabled: true },
];
Expand All @@ -47,34 +54,34 @@ const endSections = [
<div class="Sidebar__sections">
<div>
<img class="Sidebar__logo" src="/logo2.png" alt="CCSS Logo" />
<hr style="border-color: #f1f1f12e; margin-bottom: 0.2rem" />
<SidebarItem
icon={"mdi mdi-school"}
title={"COMP 2804"}
link={"/comp2804"}
disabled={false}
/>
<hr style="border-color: #f1f1f12e; margin-top: 0.2rem" />
{
sections.map((section) => (
<a href={section.link}>
<div
class={`Sidebar__item ${section.disabled ? "Sidebar__item--disabled" : "Sidebar__item--enabled"}`}
>
<div class="Sidebar__item__icon">
<i class={section.icon} />
</div>
<div class="Sidebar__item__title">{section.title}</div>
</div>
</a>
<SidebarItem
icon={section.icon}
title={section.title}
link={section.link}
disabled={section.disabled}
/>
))
}
</div>
<div>
{
endSections.map((endSection) => (
<a href={endSection.link}>
<div
class={`Sidebar__item ${endSection.disabled ? "Sidebar__item--disabled" : "Sidebar__item--enabled"}`}
>
<div class="Sidebar__item__icon">
<i class={endSection.icon} />
</div>
<div class="Sidebar__item__title">{endSection.title}</div>
</div>
</a>
<SidebarItem
icon={endSection.icon}
title={endSection.title}
link={endSection.link}
disabled={endSection.disabled}
/>
))
}
</div>
Expand Down
14 changes: 14 additions & 0 deletions src/components/Sidebar/SidebarItem.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
const { link, disabled, icon, title } = Astro.props;
---

<a href={link}>
<div
class={`Sidebar__item ${disabled ? "Sidebar__item--disabled" : "Sidebar__item--enabled"}`}
>
<div class="Sidebar__item__icon">
<i class={icon}></i>
</div>
<div class="Sidebar__item__title">{title}</div>
</div>
</a>
13 changes: 13 additions & 0 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ const questionCollection = defineCollection({
// }),
});

const courseCollection = defineCollection({
type: "content",
schema: z.object({
id: z.string(),
code: z.string(),
title: z.string(),
description: z.string(),
textbook: z.string(),
textbookUrl: z.string(),
}),
});

const evaluationCollection = defineCollection({
type: "content",
schema: z.object({
Expand All @@ -35,6 +47,7 @@ const tagCollection = defineCollection({
});

export const collections = {
courses: courseCollection,
questions: questionCollection,
evaluations: evaluationCollection,
tags: tagCollection,
Expand Down
8 changes: 8 additions & 0 deletions src/content/courses/comp2804.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
id: comp2804
code: COMP 2804
title: Discrete Structures II
description: "Topics include: counting, sequences and sums, discrete probability, basic statistics, recurrence relations, randomized algorithms. Material is illustrated through examples from computing."
textbook: "Discrete Structures for Computer Science: Counting, Recursion, and Probability"
textbookUrl: https://patmorin.me/teaching/2804/resources/DiscreteStructures.pdf
---
2 changes: 1 addition & 1 deletion src/layouts/Content/Content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
.Question__tags {
display: flex;
gap: 0.5rem;
margin-top: 3rem;
margin-top: 2rem;
flex-wrap: wrap;
}

Expand Down
Loading

0 comments on commit 9aeecb4

Please sign in to comment.