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:
@@ -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>;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"));
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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}>
|
||||
|
||||
Reference in New Issue
Block a user