generated from 202306-NEA-DZ-FEW/capstone-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of github.com:ismail-benlaredj/recoded-capstone in…
…to dev
- Loading branch information
Showing
14 changed files
with
2,298 additions
and
43 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { cva } from "class-variance-authority"; | ||
import Link from "next/link"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
const buttonVariantStyle = cva( | ||
"flex items-center rounded-full gap-5 justify-center font-medium transition-colors text-base items-center", | ||
{ | ||
variants: { | ||
variant: { | ||
default: | ||
"bg-green text-white hover:opacity-90 active:ring-2 active:ring-green ", | ||
outlinePrimary: | ||
"bg-transparent border-2 border-green text-green hover:bg-emerald-100 active:ring-2 active:ring-green ", | ||
outlineSecondary: | ||
"bg-transparent border-2 border-red text-red hover:bg-rose-100 active:ring-2 active:ring-red ", | ||
}, | ||
size: { | ||
default: "h-9 py-3 px-6 gap-3", | ||
lg: "h-10 px-8 gap-4", | ||
full: "w-full h-10 px-8 gap-4", | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: "default", | ||
size: "default", | ||
}, | ||
}, | ||
); | ||
const Button = ({ className, children, href, variant, size, ...props }) => { | ||
if (href) { | ||
return ( | ||
<Link | ||
href={href} | ||
className={cn(buttonVariantStyle({ variant, size, className }))} | ||
> | ||
{children} | ||
</Link> | ||
); | ||
} | ||
return ( | ||
<button | ||
className={cn(buttonVariantStyle({ variant, size, className }))} | ||
{...props} | ||
> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import fs from "fs"; | ||
import matter from "gray-matter"; | ||
import { join } from "path"; | ||
import { remark } from "remark"; | ||
import html from "remark-html"; | ||
|
||
// const postsDirectory = join(process.cwd(), '_posts') | ||
const postsDirectory = "./src/pages/blog/_posts"; | ||
|
||
export function getPostSlugs() { | ||
return fs.readdirSync(postsDirectory); | ||
} | ||
|
||
export function getPostBySlug(slug, fields = []) { | ||
const realSlug = slug.replace(/\.md$/, ""); | ||
const fullPath = join(postsDirectory, `${realSlug}.md`); | ||
const fileContents = fs.readFileSync(fullPath, "utf8"); | ||
const { data, content } = matter(fileContents); | ||
|
||
const items = {}; | ||
|
||
// Ensure only the minimal needed data is exposed | ||
fields.forEach((field) => { | ||
if (field === "slug") { | ||
items[field] = realSlug; | ||
} | ||
if (field === "content") { | ||
items[field] = content; | ||
} | ||
|
||
if (typeof data[field] !== "undefined") { | ||
items[field] = data[field]; | ||
} | ||
}); | ||
|
||
return items; | ||
} | ||
|
||
export function getAllPosts(fields) { | ||
const slugs = getPostSlugs(); | ||
const posts = slugs | ||
.map((slug) => getPostBySlug(slug, fields)) | ||
// sort posts by date in descending order | ||
.sort((post1, post2) => (post1.date > post2.date ? -1 : 1)); | ||
return posts; | ||
} | ||
|
||
export async function markdownToHtml(markdown) { | ||
const result = await remark().use(html).process(markdown); | ||
return result.toString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { clsx } from "clsx"; | ||
import { twMerge } from "tailwind-merge"; | ||
|
||
export function cn(...inputs) { | ||
return twMerge(clsx(inputs)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function AboutPage() { | ||
return <div>AboutPage</div>; | ||
} | ||
|
||
export default AboutPage; | ||
|
||
export async function getStaticProps({ locale }) { | ||
return { | ||
props: {}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* eslint-disable @next/next/no-img-element */ | ||
import ErrorPage from "next/error"; | ||
import { useRouter } from "next/router"; | ||
|
||
import { getAllPosts, getPostBySlug, markdownToHtml } from "@/lib/blogApi"; | ||
|
||
const PostHeader = ({ title, image, imageAlt, date, timeToRead }) => { | ||
return ( | ||
<> | ||
<div className='mb-20 text-center'> | ||
<img | ||
src={image} | ||
alt={imageAlt} | ||
className='w-full h-[35rem] object-cover rounded-lg' | ||
/> | ||
<h1 className='text-3xl my-8'>{title}</h1> | ||
<p>{`Time to read ${timeToRead} min`} </p> | ||
<p>{`publiched: ${new Date(date).toDateString()}`}</p> | ||
</div> | ||
</> | ||
); | ||
}; | ||
const PostBody = ({ content }) => { | ||
return ( | ||
<div className='max-w-5xl mx-auto'> | ||
<div | ||
className='prose-p:w-full lg:prose-xl w-full lg:w-[58rem] prose prose-override-width text-black | ||
prose-headings:text-black | ||
prose-h4:text-[1.7rem] | ||
prose-img:w-full ' | ||
dangerouslySetInnerHTML={{ __html: content }} | ||
/> | ||
</div> | ||
); | ||
}; | ||
export default function Post({ post }) { | ||
const router = useRouter(); | ||
const { title, content, coverImage, date } = post; | ||
if (!router.isFallback && !post?.slug) { | ||
return <ErrorPage statusCode={404} />; | ||
} | ||
return ( | ||
<> | ||
{router.isFallback ? ( | ||
<h1>Loading…</h1> | ||
) : ( | ||
<> | ||
<article className='mb-32'> | ||
<PostHeader | ||
title={title} | ||
image={coverImage} | ||
date={date} | ||
/> | ||
<PostBody content={content} /> | ||
</article> | ||
</> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export async function getStaticProps({ params }) { | ||
const post = getPostBySlug(params.slug, [ | ||
"title", | ||
"description", | ||
"slug", | ||
"coverImage", | ||
"date", | ||
"content", | ||
]); | ||
const content = await markdownToHtml(post.content || ""); | ||
return { | ||
props: { | ||
post: { | ||
...post, | ||
content, | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
export async function getStaticPaths() { | ||
const posts = getAllPosts(["slug"]); | ||
|
||
return { | ||
paths: posts.map((post) => { | ||
return { | ||
params: { | ||
slug: post.slug, | ||
}, | ||
}; | ||
}), | ||
fallback: false, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: "The Power of Sharing: How Students Can Help Each Other Succeed" | ||
description: "In the world of education, students often find themselves in a race to acquire knowledge and skills. While individual efforts are crucial, the power of sharing and helping fellow students should not be underestimated." | ||
coverImage: "https://images.unsplash.com/photo-1531545514256-b1400bc00f31?auto=format&fit=crop&q=60&w=500&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTF8fHN0dWRlbnRzfGVufDB8fDB8fHww" | ||
date: "2023-10-26" | ||
author: | ||
name: Ismail Benlaredj | ||
picture: "https://images.unsplash.com/photo-1633332755192-727a05c4013d?auto=format&fit=crop&q=60&w=500&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8OHx8YXZhdGFyfGVufDB8fDB8fHww" | ||
ogImage: | ||
url: "https://images.unsplash.com/photo-1531545514256-b1400bc00f31?auto=format&fit=crop&q=60&w=500&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTF8fHN0dWRlbnRzfGVufDB8fDB8fHww" | ||
--- | ||
|
||
In the world of education, students often find themselves in a race to acquire knowledge and skills. While individual efforts are crucial, the power of sharing and helping fellow students should not be underestimated. This cooperative approach can lead to a more supportive and successful learning environment for everyone involved. | ||
|
||
**Fostering a Culture of Collaboration** | ||
|
||
Education is not a solitary journey; it's a collective effort where students can benefit from one another's experiences and insights. The creation of a culture of collaboration can greatly enhance the learning experience. When students actively engage with their peers, it creates an environment where knowledge flows freely, and everyone has the opportunity to learn from one another. | ||
|
||
**Peer Tutoring and Mentoring** | ||
|
||
One of the most effective ways students can assist each other is through peer tutoring and mentoring. If a student excels in a particular subject, they can help their peers who may be struggling. This not only provides assistance to those in need but also reinforces the tutor's own understanding of the topic. It's a win-win situation that promotes academic growth. | ||
|
||
**Study Groups and Knowledge Sharing** | ||
|
||
Study groups are another excellent way for students to share and learn together. By pooling their knowledge, students can cover a broader range of topics and address challenging questions collaboratively. These groups foster discussion, debate, and the exchange of ideas, resulting in a deeper understanding of the material. | ||
|
||
**Online Platforms and Resources** | ||
|
||
In today's digital age, online platforms and resources have made it easier than ever for students to share their knowledge. Discussion forums, social media groups, and educational websites provide spaces for students to ask questions, share insights, and access a wealth of information. These platforms break down the barriers of geography, connecting students from all over the world. | ||
|
||
**Building Soft Skills** | ||
|
||
Sharing knowledge and helping others also builds essential soft skills such as communication, leadership, and teamwork. These skills are not only valuable in an academic context but are also highly sought after by employers. By engaging in collaboration, students enhance their personal and professional development. | ||
|
||
**Conclusion** | ||
|
||
The power of sharing among students is a force that can transform the educational landscape. By fostering a culture of collaboration, engaging in peer tutoring, forming study groups, and utilizing online resources, students can collectively enhance their learning experiences. In this supportive environment, everyone has the opportunity to succeed, grow, and thrive. | ||
|
||
So, the next time you come across a fellow student who needs assistance or have knowledge to share, remember the tremendous impact you can make by helping each other on this incredible academic journey. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: "The Power of Sharing: How Students Can Help Each Other Succeed" | ||
description: "In the world of education, students often find themselves in a race to acquire knowledge and skills. While individual efforts are crucial, the power of sharing and helping fellow students should not be underestimated. This cooperative approach can lead to a more supportive and successful learning environment for everyone involved.." | ||
coverImage: "https://images.unsplash.com/photo-1531545514256-b1400bc00f31?auto=format&fit=crop&q=60&w=500&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTF8fHN0dWRlbnRzfGVufDB8fDB8fHww" | ||
date: "2023-10-26" | ||
author: | ||
name: Ismail Benlaredj | ||
picture: "https://images.unsplash.com/photo-1633332755192-727a05c4013d?auto=format&fit=crop&q=60&w=500&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8OHx8YXZhdGFyfGVufDB8fDB8fHww" | ||
ogImage: | ||
url: "https://images.unsplash.com/photo-1531545514256-b1400bc00f31?auto=format&fit=crop&q=60&w=500&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTF8fHN0dWRlbnRzfGVufDB8fDB8fHww" | ||
--- | ||
|
||
In the world of education, students often find themselves in a race to acquire knowledge and skills. While individual efforts are crucial, the power of sharing and helping fellow students should not be underestimated. This cooperative approach can lead to a more supportive and successful learning environment for everyone involved. | ||
|
||
**Fostering a Culture of Collaboration** | ||
|
||
Education is not a solitary journey; it's a collective effort where students can benefit from one another's experiences and insights. The creation of a culture of collaboration can greatly enhance the learning experience. When students actively engage with their peers, it creates an environment where knowledge flows freely, and everyone has the opportunity to learn from one another. | ||
|
||
**Peer Tutoring and Mentoring** | ||
|
||
One of the most effective ways students can assist each other is through peer tutoring and mentoring. If a student excels in a particular subject, they can help their peers who may be struggling. This not only provides assistance to those in need but also reinforces the tutor's own understanding of the topic. It's a win-win situation that promotes academic growth. | ||
|
||
**Study Groups and Knowledge Sharing** | ||
|
||
Study groups are another excellent way for students to share and learn together. By pooling their knowledge, students can cover a broader range of topics and address challenging questions collaboratively. These groups foster discussion, debate, and the exchange of ideas, resulting in a deeper understanding of the material. | ||
|
||
**Online Platforms and Resources** | ||
|
||
In today's digital age, online platforms and resources have made it easier than ever for students to share their knowledge. Discussion forums, social media groups, and educational websites provide spaces for students to ask questions, share insights, and access a wealth of information. These platforms break down the barriers of geography, connecting students from all over the world. | ||
|
||
**Building Soft Skills** | ||
|
||
Sharing knowledge and helping others also builds essential soft skills such as communication, leadership, and teamwork. These skills are not only valuable in an academic context but are also highly sought after by employers. By engaging in collaboration, students enhance their personal and professional development. | ||
|
||
**Conclusion** | ||
|
||
The power of sharing among students is a force that can transform the educational landscape. By fostering a culture of collaboration, engaging in peer tutoring, forming study groups, and utilizing online resources, students can collectively enhance their learning experiences. In this supportive environment, everyone has the opportunity to succeed, grow, and thrive. | ||
|
||
So, the next time you come across a fellow student who needs assistance or have knowledge to share, remember the tremendous impact you can make by helping each other on this incredible academic journey. |
Oops, something went wrong.