diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c99268b..3ae6f63 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,8 +18,8 @@ jobs: - name: Install Dependencies run: npm ci - working-directory: ./next + working-directory: ./client - name: Run Lint run: npm run lint - working-directory: ./next + working-directory: ./client diff --git a/next/.eslintrc.json b/client/.eslintrc.json similarity index 100% rename from next/.eslintrc.json rename to client/.eslintrc.json diff --git a/next/.gitignore b/client/.gitignore similarity index 100% rename from next/.gitignore rename to client/.gitignore diff --git a/next/.prettierrc b/client/.prettierrc similarity index 100% rename from next/.prettierrc rename to client/.prettierrc diff --git a/next/README.md b/client/README.md similarity index 100% rename from next/README.md rename to client/README.md diff --git a/next/next.config.js b/client/next.config.js similarity index 100% rename from next/next.config.js rename to client/next.config.js diff --git a/next/package-lock.json b/client/package-lock.json similarity index 100% rename from next/package-lock.json rename to client/package-lock.json diff --git a/next/package.json b/client/package.json similarity index 100% rename from next/package.json rename to client/package.json diff --git a/next/public/images/about/2F6ACD0F-D23F-4006-97D8-5D062B0EB330_1_105_c.jpeg b/client/public/images/about/2F6ACD0F-D23F-4006-97D8-5D062B0EB330_1_105_c.jpeg similarity index 100% rename from next/public/images/about/2F6ACD0F-D23F-4006-97D8-5D062B0EB330_1_105_c.jpeg rename to client/public/images/about/2F6ACD0F-D23F-4006-97D8-5D062B0EB330_1_105_c.jpeg diff --git a/next/public/images/about/3D037048-F26D-464D-BB7E-13AA8696C6B9_1_105_c.jpeg b/client/public/images/about/3D037048-F26D-464D-BB7E-13AA8696C6B9_1_105_c.jpeg similarity index 100% rename from next/public/images/about/3D037048-F26D-464D-BB7E-13AA8696C6B9_1_105_c.jpeg rename to client/public/images/about/3D037048-F26D-464D-BB7E-13AA8696C6B9_1_105_c.jpeg diff --git a/next/public/images/about/EF46B464-0160-404D-B2B4-33224F118617_1_105_c.jpeg b/client/public/images/about/EF46B464-0160-404D-B2B4-33224F118617_1_105_c.jpeg similarity index 100% rename from next/public/images/about/EF46B464-0160-404D-B2B4-33224F118617_1_105_c.jpeg rename to client/public/images/about/EF46B464-0160-404D-B2B4-33224F118617_1_105_c.jpeg diff --git a/next/public/images/category/x.svg b/client/public/images/category/x.svg similarity index 99% rename from next/public/images/category/x.svg rename to client/public/images/category/x.svg index 524c6b3..165ad53 100644 --- a/next/public/images/category/x.svg +++ b/client/public/images/category/x.svg @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/next/public/images/dusan.png b/client/public/images/dusan.png similarity index 100% rename from next/public/images/dusan.png rename to client/public/images/dusan.png diff --git a/next/public/images/search/icon.svg b/client/public/images/search/icon.svg similarity index 100% rename from next/public/images/search/icon.svg rename to client/public/images/search/icon.svg diff --git a/next/public/images/social-icons/icon-github.svg b/client/public/images/social-icons/icon-github.svg similarity index 100% rename from next/public/images/social-icons/icon-github.svg rename to client/public/images/social-icons/icon-github.svg diff --git a/next/public/images/social-icons/icon-linkedin.svg b/client/public/images/social-icons/icon-linkedin.svg similarity index 100% rename from next/public/images/social-icons/icon-linkedin.svg rename to client/public/images/social-icons/icon-linkedin.svg diff --git a/next/public/images/social-icons/icon-mail.svg b/client/public/images/social-icons/icon-mail.svg similarity index 100% rename from next/public/images/social-icons/icon-mail.svg rename to client/public/images/social-icons/icon-mail.svg diff --git a/next/src/app/(home)/(featured-posts)/FeaturedPosts.tsx b/client/src/app/(home)/(featured-posts)/FeaturedPosts.tsx similarity index 100% rename from next/src/app/(home)/(featured-posts)/FeaturedPosts.tsx rename to client/src/app/(home)/(featured-posts)/FeaturedPosts.tsx diff --git a/next/src/app/(home)/(featured-posts)/styles.module.scss b/client/src/app/(home)/(featured-posts)/styles.module.scss similarity index 100% rename from next/src/app/(home)/(featured-posts)/styles.module.scss rename to client/src/app/(home)/(featured-posts)/styles.module.scss diff --git a/next/src/app/(home)/(image-and-text)/ImageAndText.tsx b/client/src/app/(home)/(image-and-text)/ImageAndText.tsx similarity index 100% rename from next/src/app/(home)/(image-and-text)/ImageAndText.tsx rename to client/src/app/(home)/(image-and-text)/ImageAndText.tsx diff --git a/next/src/app/(home)/(image-and-text)/styles.module.scss b/client/src/app/(home)/(image-and-text)/styles.module.scss similarity index 100% rename from next/src/app/(home)/(image-and-text)/styles.module.scss rename to client/src/app/(home)/(image-and-text)/styles.module.scss diff --git a/next/src/app/(home)/page.tsx b/client/src/app/(home)/page.tsx similarity index 100% rename from next/src/app/(home)/page.tsx rename to client/src/app/(home)/page.tsx diff --git a/next/src/app/about/(image-section)/ImageSection.tsx b/client/src/app/about/(image-section)/ImageSection.tsx similarity index 100% rename from next/src/app/about/(image-section)/ImageSection.tsx rename to client/src/app/about/(image-section)/ImageSection.tsx diff --git a/next/src/app/about/(image-section)/data.ts b/client/src/app/about/(image-section)/data.ts similarity index 100% rename from next/src/app/about/(image-section)/data.ts rename to client/src/app/about/(image-section)/data.ts diff --git a/next/src/app/about/page.tsx b/client/src/app/about/page.tsx similarity index 100% rename from next/src/app/about/page.tsx rename to client/src/app/about/page.tsx diff --git a/next/src/app/about/styles.module.scss b/client/src/app/about/styles.module.scss similarity index 100% rename from next/src/app/about/styles.module.scss rename to client/src/app/about/styles.module.scss diff --git a/next/src/app/blog/(search-bar)/SearchBar.tsx b/client/src/app/blog/(search-bar)/SearchBar.tsx similarity index 100% rename from next/src/app/blog/(search-bar)/SearchBar.tsx rename to client/src/app/blog/(search-bar)/SearchBar.tsx diff --git a/next/src/app/blog/(search-bar)/styles.module.scss b/client/src/app/blog/(search-bar)/styles.module.scss similarity index 100% rename from next/src/app/blog/(search-bar)/styles.module.scss rename to client/src/app/blog/(search-bar)/styles.module.scss diff --git a/next/src/app/blog/(search-bar)/useDebounce.tsx b/client/src/app/blog/(search-bar)/useDebounce.tsx similarity index 100% rename from next/src/app/blog/(search-bar)/useDebounce.tsx rename to client/src/app/blog/(search-bar)/useDebounce.tsx diff --git a/next/src/app/blog/[slug]/(blog-content)/BlogContent.tsx b/client/src/app/blog/[slug]/(blog-content)/BlogContent.tsx similarity index 100% rename from next/src/app/blog/[slug]/(blog-content)/BlogContent.tsx rename to client/src/app/blog/[slug]/(blog-content)/BlogContent.tsx diff --git a/next/src/app/blog/[slug]/(blog-content)/styles.scss b/client/src/app/blog/[slug]/(blog-content)/styles.scss similarity index 100% rename from next/src/app/blog/[slug]/(blog-content)/styles.scss rename to client/src/app/blog/[slug]/(blog-content)/styles.scss diff --git a/next/src/app/blog/[slug]/(blog-header)/BlogHeader.tsx b/client/src/app/blog/[slug]/(blog-header)/BlogHeader.tsx similarity index 100% rename from next/src/app/blog/[slug]/(blog-header)/BlogHeader.tsx rename to client/src/app/blog/[slug]/(blog-header)/BlogHeader.tsx diff --git a/next/src/app/blog/[slug]/(blog-header)/styles.module.scss b/client/src/app/blog/[slug]/(blog-header)/styles.module.scss similarity index 100% rename from next/src/app/blog/[slug]/(blog-header)/styles.module.scss rename to client/src/app/blog/[slug]/(blog-header)/styles.module.scss diff --git a/next/src/app/blog/[slug]/page.tsx b/client/src/app/blog/[slug]/page.tsx similarity index 100% rename from next/src/app/blog/[slug]/page.tsx rename to client/src/app/blog/[slug]/page.tsx diff --git a/client/src/app/blog/_navigation/Navigation.tsx b/client/src/app/blog/_navigation/Navigation.tsx new file mode 100644 index 0000000..851e7fa --- /dev/null +++ b/client/src/app/blog/_navigation/Navigation.tsx @@ -0,0 +1,42 @@ +import React, { FunctionComponent } from 'react'; +import styles from './styles.module.scss'; +import Link from 'next/link'; +import qs from 'qs'; + +interface Props { + pageNumber: number; + currentPageCount: number; + category: string | undefined; +} + +const Navigation: FunctionComponent = ({ currentPageCount, pageNumber, category }) => { + const queryParamsPrevious = { + category, + page: pageNumber - 1 + }; + + const queryParamsNext = { + category, + page: pageNumber + 1 + }; + + const queryStringPrevious = qs.stringify(queryParamsPrevious); + const queryStringNext = qs.stringify(queryParamsNext); + + return ( +
+ {Boolean(pageNumber > 1) && ( + + Previous + + )} + {currentPageCount !== pageNumber && ( + + Next + + )} +
+ ); +}; + +export default Navigation; \ No newline at end of file diff --git a/client/src/app/blog/_navigation/styles.module.scss b/client/src/app/blog/_navigation/styles.module.scss new file mode 100644 index 0000000..0c738d1 --- /dev/null +++ b/client/src/app/blog/_navigation/styles.module.scss @@ -0,0 +1,16 @@ +@import '@/styles/vars'; + +.container { + display: flex; + margin-inline: auto; + gap: 1rem; + margin-top: 2rem; + + a { + color: darken($color-text, 40%); + + &:hover { + color: $color-accent; + } + } +} \ No newline at end of file diff --git a/next/src/app/blog/page.tsx b/client/src/app/blog/page.tsx similarity index 65% rename from next/src/app/blog/page.tsx rename to client/src/app/blog/page.tsx index a75f8cf..bfb48f6 100644 --- a/next/src/app/blog/page.tsx +++ b/client/src/app/blog/page.tsx @@ -6,15 +6,19 @@ import React from 'react'; import { db } from '@/scripts/fetch'; import Categories from '@/components/categories/Categories'; import SearchBar from '@/app/blog/(search-bar)/SearchBar'; +import Navigation from '@/app/blog/_navigation/Navigation'; interface Props { searchParams: { category?: string; + page?: string; }; } -const Page: NextPage = async ({ searchParams: { category } }) => { - const posts = category ? await db.getPostsByCategory(category) : await db.getPosts(); +const Page: NextPage = async ({ searchParams: { category, page } }) => { + const pageNumber = parseInt(page ?? '1'); + + const posts = category ? await db.getPostsByCategory(category, pageNumber) : await db.getPosts(pageNumber); const categories = await db.getCategories(); return ( @@ -26,6 +30,9 @@ const Page: NextPage = async ({ searchParams: { category } }) => {
{posts.data.map((post) => )}
+ {Boolean(posts.meta.pagination.pageCount > 1) && ( + + )} ); diff --git a/next/src/app/blog/styles.module.scss b/client/src/app/blog/styles.module.scss similarity index 100% rename from next/src/app/blog/styles.module.scss rename to client/src/app/blog/styles.module.scss diff --git a/next/src/app/layout.tsx b/client/src/app/layout.tsx similarity index 100% rename from next/src/app/layout.tsx rename to client/src/app/layout.tsx diff --git a/next/src/app/skills/(experience)/(experience-items)/ExperienceItems.tsx b/client/src/app/skills/(experience)/(experience-items)/ExperienceItems.tsx similarity index 100% rename from next/src/app/skills/(experience)/(experience-items)/ExperienceItems.tsx rename to client/src/app/skills/(experience)/(experience-items)/ExperienceItems.tsx diff --git a/next/src/app/skills/(experience)/(experience-items)/scripts.ts b/client/src/app/skills/(experience)/(experience-items)/scripts.ts similarity index 100% rename from next/src/app/skills/(experience)/(experience-items)/scripts.ts rename to client/src/app/skills/(experience)/(experience-items)/scripts.ts diff --git a/next/src/app/skills/(experience)/(experience-items)/styles.module.scss b/client/src/app/skills/(experience)/(experience-items)/styles.module.scss similarity index 100% rename from next/src/app/skills/(experience)/(experience-items)/styles.module.scss rename to client/src/app/skills/(experience)/(experience-items)/styles.module.scss diff --git a/next/src/app/skills/(experience)/Experience.tsx b/client/src/app/skills/(experience)/Experience.tsx similarity index 100% rename from next/src/app/skills/(experience)/Experience.tsx rename to client/src/app/skills/(experience)/Experience.tsx diff --git a/next/src/app/skills/(experience)/data.ts b/client/src/app/skills/(experience)/data.ts similarity index 100% rename from next/src/app/skills/(experience)/data.ts rename to client/src/app/skills/(experience)/data.ts diff --git a/next/src/app/skills/(skills)/(skill-items)/SkillItem.tsx b/client/src/app/skills/(skills)/(skill-items)/SkillItem.tsx similarity index 100% rename from next/src/app/skills/(skills)/(skill-items)/SkillItem.tsx rename to client/src/app/skills/(skills)/(skill-items)/SkillItem.tsx diff --git a/next/src/app/skills/(skills)/(skill-items)/styles.module.scss b/client/src/app/skills/(skills)/(skill-items)/styles.module.scss similarity index 100% rename from next/src/app/skills/(skills)/(skill-items)/styles.module.scss rename to client/src/app/skills/(skills)/(skill-items)/styles.module.scss diff --git a/next/src/app/skills/(skills)/Skills.tsx b/client/src/app/skills/(skills)/Skills.tsx similarity index 100% rename from next/src/app/skills/(skills)/Skills.tsx rename to client/src/app/skills/(skills)/Skills.tsx diff --git a/next/src/app/skills/(skills)/data.ts b/client/src/app/skills/(skills)/data.ts similarity index 100% rename from next/src/app/skills/(skills)/data.ts rename to client/src/app/skills/(skills)/data.ts diff --git a/next/src/app/skills/page.tsx b/client/src/app/skills/page.tsx similarity index 100% rename from next/src/app/skills/page.tsx rename to client/src/app/skills/page.tsx diff --git a/next/src/app/skills/styles.module.scss b/client/src/app/skills/styles.module.scss similarity index 100% rename from next/src/app/skills/styles.module.scss rename to client/src/app/skills/styles.module.scss diff --git a/next/src/components/author-card/AuthorCard.tsx b/client/src/components/author-card/AuthorCard.tsx similarity index 100% rename from next/src/components/author-card/AuthorCard.tsx rename to client/src/components/author-card/AuthorCard.tsx diff --git a/next/src/components/author-card/styles.module.scss b/client/src/components/author-card/styles.module.scss similarity index 100% rename from next/src/components/author-card/styles.module.scss rename to client/src/components/author-card/styles.module.scss diff --git a/next/src/components/blog-post-item/BlogPostItem.tsx b/client/src/components/blog-post-item/BlogPostItem.tsx similarity index 100% rename from next/src/components/blog-post-item/BlogPostItem.tsx rename to client/src/components/blog-post-item/BlogPostItem.tsx diff --git a/next/src/components/blog-post-item/scripts.ts b/client/src/components/blog-post-item/scripts.ts similarity index 100% rename from next/src/components/blog-post-item/scripts.ts rename to client/src/components/blog-post-item/scripts.ts diff --git a/next/src/components/blog-post-item/styles.module.scss b/client/src/components/blog-post-item/styles.module.scss similarity index 100% rename from next/src/components/blog-post-item/styles.module.scss rename to client/src/components/blog-post-item/styles.module.scss diff --git a/next/src/components/blog-post-item/types.ts b/client/src/components/blog-post-item/types.ts similarity index 100% rename from next/src/components/blog-post-item/types.ts rename to client/src/components/blog-post-item/types.ts diff --git a/next/src/components/categories/Categories.tsx b/client/src/components/categories/Categories.tsx similarity index 100% rename from next/src/components/categories/Categories.tsx rename to client/src/components/categories/Categories.tsx diff --git a/next/src/components/categories/category-link/CategoryLink.tsx b/client/src/components/categories/category-link/CategoryLink.tsx similarity index 100% rename from next/src/components/categories/category-link/CategoryLink.tsx rename to client/src/components/categories/category-link/CategoryLink.tsx diff --git a/next/src/components/categories/category-link/styles.module.scss b/client/src/components/categories/category-link/styles.module.scss similarity index 100% rename from next/src/components/categories/category-link/styles.module.scss rename to client/src/components/categories/category-link/styles.module.scss diff --git a/next/src/components/categories/styles.module.scss b/client/src/components/categories/styles.module.scss similarity index 100% rename from next/src/components/categories/styles.module.scss rename to client/src/components/categories/styles.module.scss diff --git a/next/src/components/categories/types.ts b/client/src/components/categories/types.ts similarity index 100% rename from next/src/components/categories/types.ts rename to client/src/components/categories/types.ts diff --git a/next/src/components/footer/Footer.tsx b/client/src/components/footer/Footer.tsx similarity index 100% rename from next/src/components/footer/Footer.tsx rename to client/src/components/footer/Footer.tsx diff --git a/next/src/components/footer/social-icons/SocialIcons.tsx b/client/src/components/footer/social-icons/SocialIcons.tsx similarity index 100% rename from next/src/components/footer/social-icons/SocialIcons.tsx rename to client/src/components/footer/social-icons/SocialIcons.tsx diff --git a/next/src/components/footer/social-icons/single-social-icon/SingleSocialIcon.tsx b/client/src/components/footer/social-icons/single-social-icon/SingleSocialIcon.tsx similarity index 100% rename from next/src/components/footer/social-icons/single-social-icon/SingleSocialIcon.tsx rename to client/src/components/footer/social-icons/single-social-icon/SingleSocialIcon.tsx diff --git a/next/src/components/footer/social-icons/styles.module.scss b/client/src/components/footer/social-icons/styles.module.scss similarity index 100% rename from next/src/components/footer/social-icons/styles.module.scss rename to client/src/components/footer/social-icons/styles.module.scss diff --git a/next/src/components/footer/styles.module.scss b/client/src/components/footer/styles.module.scss similarity index 100% rename from next/src/components/footer/styles.module.scss rename to client/src/components/footer/styles.module.scss diff --git a/next/src/components/header/Header.tsx b/client/src/components/header/Header.tsx similarity index 100% rename from next/src/components/header/Header.tsx rename to client/src/components/header/Header.tsx diff --git a/next/src/components/header/nav-link/NavLink.tsx b/client/src/components/header/nav-link/NavLink.tsx similarity index 100% rename from next/src/components/header/nav-link/NavLink.tsx rename to client/src/components/header/nav-link/NavLink.tsx diff --git a/next/src/components/header/nav-link/styles.module.scss b/client/src/components/header/nav-link/styles.module.scss similarity index 100% rename from next/src/components/header/nav-link/styles.module.scss rename to client/src/components/header/nav-link/styles.module.scss diff --git a/next/src/components/header/styles.module.scss b/client/src/components/header/styles.module.scss similarity index 100% rename from next/src/components/header/styles.module.scss rename to client/src/components/header/styles.module.scss diff --git a/next/src/components/loading-indicator/LoadingIndicator.tsx b/client/src/components/loading-indicator/LoadingIndicator.tsx similarity index 100% rename from next/src/components/loading-indicator/LoadingIndicator.tsx rename to client/src/components/loading-indicator/LoadingIndicator.tsx diff --git a/next/src/components/loading-indicator/styles.scss b/client/src/components/loading-indicator/styles.scss similarity index 100% rename from next/src/components/loading-indicator/styles.scss rename to client/src/components/loading-indicator/styles.scss diff --git a/next/src/scripts/fetch.ts b/client/src/scripts/fetch.ts similarity index 95% rename from next/src/scripts/fetch.ts rename to client/src/scripts/fetch.ts index b7f9032..fe44de4 100644 --- a/next/src/scripts/fetch.ts +++ b/client/src/scripts/fetch.ts @@ -24,19 +24,19 @@ export const fetchWrapper = async (url: string | URL) => { }; export const db = { - getPosts: async () => { + getPosts: async (page: number ) => { const queryParams = { sort: ['publishedAt:desc'], pagination: { pageSize: 10, - page: 1 + page } }; const queryString = qs.stringify(queryParams); return await fetchWrapper(`/posts?${queryString}`); }, - getPostsByCategory: async (category: string) => { + getPostsByCategory: async (category: string, page: number) => { const queryParams = { sort: ['publishedAt:desc'], filters: { @@ -48,7 +48,7 @@ export const db = { }, pagination: { pageSize: 10, - page: 1 + page } }; diff --git a/next/src/styles/about-and-blog-content.module.scss b/client/src/styles/about-and-blog-content.module.scss similarity index 100% rename from next/src/styles/about-and-blog-content.module.scss rename to client/src/styles/about-and-blog-content.module.scss diff --git a/next/src/styles/global.module.scss b/client/src/styles/global.module.scss similarity index 100% rename from next/src/styles/global.module.scss rename to client/src/styles/global.module.scss diff --git a/next/src/styles/global.scss b/client/src/styles/global.scss similarity index 100% rename from next/src/styles/global.scss rename to client/src/styles/global.scss diff --git a/next/src/styles/vars.scss b/client/src/styles/vars.scss similarity index 100% rename from next/src/styles/vars.scss rename to client/src/styles/vars.scss diff --git a/next/tsconfig.json b/client/tsconfig.json similarity index 100% rename from next/tsconfig.json rename to client/tsconfig.json