Skip to content

Commit 9e65a47

Browse files
author
dev
committed
blog: put use types for Props
1 parent 7e7b074 commit 9e65a47

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

phoenix-blog/src/pages/base.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import type { FC } from 'hono/jsx';
22
import { raw } from 'hono/html';
3+
import { Blog } from '@phoenix/core/entities';
34

4-
export const Base: FC = (props) => {
5-
const base = (props: any) => (
5+
type Props = {
6+
blog?: Blog,
7+
children?: any,
8+
title?: string;
9+
};
10+
11+
export const Base: FC = (props: Props) => {
12+
const base = (props: Props) => (
613
<html>
714
<head>
815
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
@@ -14,6 +21,8 @@ export const Base: FC = (props) => {
1421
<meta name="robots" content="noindex" />
1522
<link href="/theme/index.css" rel="stylesheet" />
1623
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
24+
25+
<title>{ props.blog?.name }{ props.title ? `- ${props.title}` : ''}</title>
1726
</head>
1827
<body>
1928
<div class="bg-white py-12">

phoenix-blog/src/pages/error.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import type { FC } from 'hono/jsx';
22
import { Base } from './base';
33

4-
export const ErrorTemplate: FC<{ error: string }> = (props: { error: string }) => {
4+
type Props = {
5+
error: string,
6+
}
7+
8+
export const ErrorTemplate: FC<Props> = (props: Props) => {
59
return (
610
<Base>
711
<div class="flex flex-col space-y-6">

phoenix-blog/src/pages/page.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ import { Blog, Page } from '@phoenix/core/entities';
22
import type { FC } from 'hono/jsx';
33
import { Base } from './base';
44

5-
export const PageTemplate: FC<{ page: Page, blog: Blog }> = (props: { page: Page, blog: Blog }) => {
5+
type Props = {
6+
blog: Blog,
7+
page: Page,
8+
}
9+
10+
export const PageTemplate: FC<Props> = (props: Props) => {
611
return (
7-
<Base blog={props.blog}>
12+
<Base blog={props.blog} title={props.page.title}>
813
<div class="flex flex-col">
914
<div class="flex">
1015
<h2 class="text-3xl font-bold">

phoenix-blog/src/pages/posts.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import type { FC } from 'hono/jsx';
33
import { Base } from './base';
44
import { date } from '../utils';
55

6-
export const PostsTemplate: FC<{ posts: Page[], blog: Blog }> = (props: { posts: Page[], blog: Blog }) => {
6+
type Props = {
7+
posts: Page[],
8+
blog: Blog,
9+
}
10+
11+
export const PostsTemplate: FC<Props> = (props: Props) => {
712
return (
813
<Base blog={props.blog}>
914
{props.posts.map((post) => (

0 commit comments

Comments
 (0)