added type definitions

This commit is contained in:
ferdous
2023-05-21 11:42:20 +06:00
parent 1431ce1d35
commit 41cf468580
27 changed files with 115 additions and 58 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import config from "@/config/config.json";
import { humanize, plainify, slugify } from "@/lib/utils/textConverter";
import { FaRegFolder, FaRegUserCircle } from "react-icons/fa/index.js";
const { summary_length, blog_folder } = config.settings;
const { summary_length, blog_folder }: {summary_length: number, blog_folder: string} = config.settings;
const { data } = Astro.props;
const { title, image, date, author, categories } = data.data;
---
+1 -1
View File
@@ -1,7 +1,7 @@
---
import { humanize } from "@/lib/utils/textConverter";
const { className } = Astro.props;
const { className }: {className?: string} = Astro.props;
const paths = Astro.url.pathname.split("/").filter((x) => x);
let parts = [
+1 -1
View File
@@ -2,7 +2,7 @@
import { Image } from "@astrojs/image/components";
import config from "@/config/config.json";
const { src, srcDarkmode } = Astro.props;
const { src, srcDarkmode } : {src?: string, srcDarkmode?: string} = Astro.props;
const {
logo,
logo_darkmode,
+6 -3
View File
@@ -1,11 +1,14 @@
---
const { section, currentPage, totalPages } = Astro.props;
type Pagination = {
section?: string, currentPage?: number, totalPages?: number
}
const { section, currentPage=1, totalPages=1 }: Pagination = Astro.props;
const indexPageLink = currentPage === 2;
const hasPrevPage = currentPage > 1;
const hasNextPage = totalPages > currentPage;
const hasNextPage = totalPages > currentPage!;
let pageList = [];
let pageList: number[] = [];
for (let i = 1; i <= totalPages; i++) {
pageList.push(i);
}
+2 -2
View File
@@ -7,8 +7,8 @@ import {
IoLogoTwitter,
} from "react-icons/io5/index.js";
const { base_url } = config.site;
const { title, description, slug, className } = Astro.props;
const { base_url }: {base_url: string} = config.site;
const { title, description, slug, className }: {title?: string, description?: string, slug?: string, className?: string} = Astro.props;
---
<ul class={`${className}`}>
+34 -1
View File
@@ -35,6 +35,39 @@ import {
IoMail,
} from "react-icons/io5/index.js";
type SocialLink = {
facebook: string,
twitter: string,
mastodon: string,
instagram: string,
youtube: string,
linkedin: string,
github: string,
gitlab: string,
discord: string,
slack: string,
medium: string,
codepen: string,
bitbucket: string,
dribbble: string,
behance: string,
pinterest: string,
soundcloud: string,
tumblr: string,
reddit: string,
vk: string,
whatsapp: string,
snapchat: string,
vimeo: string,
tiktok: string,
foursquare: string,
rss: string,
email: string,
phone: string,
address: string,
skype: string,
website: string,
}
const {
facebook,
twitter,
@@ -67,7 +100,7 @@ const {
address,
skype,
website,
} = source;
}: SocialLink = source;
---
<ul class={className}>
+2 -2
View File
@@ -1,8 +1,8 @@
---
import config from "@/config/config.json";
const { theme_switcher, default_theme } = config.settings;
const {className} = Astro.props;
const { theme_switcher, default_theme }: { theme_switcher: boolean, default_theme: string } = config.settings;
const {className}: {className?: string} = Astro.props;
---
{