1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-01-10 16:22:55 -05:00

start extracting types to shared .d.ts file

This commit is contained in:
2022-01-10 14:18:33 -05:00
parent b552b6ae64
commit 0ef7ff5f92
12 changed files with 45 additions and 30 deletions

View File

@@ -1,7 +1,8 @@
import styles from "./Content.module.css";
import type { ReactNode } from "react";
type Props = {
children: unknown;
children: ReactNode;
};
const Content = ({ children }: Props) => <div className={styles.content}>{children}</div>;

View File

@@ -2,11 +2,10 @@ import { useState, useEffect } from "react";
import copy from "copy-to-clipboard";
import innerText from "react-innertext";
import { CopyOcticon, CheckOcticon } from "../icons/octicons";
import type { ReactNode } from "react";
import styles from "./CopyButton.module.css";
import type { ReactNode } from "react";
type Props = {
source: ReactNode;
timeout?: number;

View File

@@ -1,6 +1,12 @@
import dynamic from "next/dynamic";
import type { ReactNode } from "react";
const CustomCode = (props: any) => {
type Props = {
className?: string;
children: ReactNode;
};
const CustomCode = (props: Props) => {
if (props.className?.split(" ").includes("hljs")) {
const CopyButton = dynamic(() => import("../clipboard/CopyButton"));

View File

@@ -1,19 +1,13 @@
import Link from "next/link";
import { format } from "date-fns";
import type { NoteMetaType } from "../../types";
import styles from "./List.module.css";
type NoteProps = {
title: string;
htmlTitle?: string;
date: string;
slug: string;
};
const List = ({ notesByYear }) => {
const sections = [];
Object.entries(notesByYear).forEach(([year, notes]: [string, NoteProps[]]) => {
Object.entries(notesByYear).forEach(([year, notes]: [string, NoteMetaType[]]) => {
sections.push(
<section key={year} className={styles.section}>
<h2 className={styles.year}>{year}</h2>

View File

@@ -3,18 +3,11 @@ import { format } from "date-fns";
import Hits from "../hits/Hits";
import { DateIcon, TagIcon, EditIcon, ViewsIcon } from "../icons";
import * as config from "../../lib/config";
import type { NoteMetaType } from "../../types";
import styles from "./Meta.module.css";
export type Props = {
title: string;
htmlTitle?: string;
date: string;
slug: string;
tags?: string[];
};
const Meta = ({ title, htmlTitle = "", date, slug, tags = [] }: Props) => (
const Meta = ({ title, htmlTitle, date, slug, tags = [] }: NoteMetaType) => (
<>
<div className={styles.meta}>
<div className={styles.date}>