mirror of
https://github.com/10h30/astroplate.git
synced 2026-07-19 06:33:33 +09:00
added type definitions
This commit is contained in:
@@ -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,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 = [
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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}`}>
|
||||
|
||||
@@ -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}>
|
||||
|
||||
@@ -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;
|
||||
---
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user