1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-15 05:45:33 -04:00

export prop types from component files

This commit is contained in:
2022-02-16 10:39:32 -05:00
parent 17104d765b
commit 3bc3e1b5a1
33 changed files with 35 additions and 35 deletions

View File

@@ -2,7 +2,7 @@ import classNames from "classnames";
import styles from "./Blockquote.module.css"; import styles from "./Blockquote.module.css";
type BlockquoteProps = JSX.IntrinsicElements["blockquote"]; export type BlockquoteProps = JSX.IntrinsicElements["blockquote"];
const Blockquote = ({ className, ...rest }: BlockquoteProps) => ( const Blockquote = ({ className, ...rest }: BlockquoteProps) => (
<blockquote className={classNames(styles.blockquote, className)} {...rest} /> <blockquote className={classNames(styles.blockquote, className)} {...rest} />

View File

@@ -3,7 +3,7 @@ import Head from "next/head";
import { useTheme } from "next-themes"; import { useTheme } from "next-themes";
import HCaptcha from "@hcaptcha/react-hcaptcha"; import HCaptcha from "@hcaptcha/react-hcaptcha";
type CaptchaProps = { export type CaptchaProps = {
size?: "normal" | "compact" | "invisible"; size?: "normal" | "compact" | "invisible";
theme?: "light" | "dark"; theme?: "light" | "dark";
id?: string; id?: string;

View File

@@ -3,7 +3,7 @@ import CopyButton from "../CopyButton/CopyButton";
import styles from "./CodeBlock.module.css"; import styles from "./CodeBlock.module.css";
type CodeBlockProps = JSX.IntrinsicElements["code"] & { export type CodeBlockProps = JSX.IntrinsicElements["code"] & {
forceBlock?: boolean; forceBlock?: boolean;
}; };

View File

@@ -3,7 +3,7 @@ import css from "styled-jsx/css";
import classNames from "classnames"; import classNames from "classnames";
import Link, { CustomLinkProps } from "../Link/Link"; import Link, { CustomLinkProps } from "../Link/Link";
type ColorfulLinkProps = CustomLinkProps & { export type ColorfulLinkProps = CustomLinkProps & {
lightColor: string; lightColor: string;
darkColor: string; darkColor: string;
}; };

View File

@@ -7,7 +7,7 @@ import type { GiscusProps } from "@giscus/react";
import styles from "./Comments.module.css"; import styles from "./Comments.module.css";
type CommentsProps = JSX.IntrinsicElements["div"] & { export type CommentsProps = JSX.IntrinsicElements["div"] & {
title: string; title: string;
}; };

View File

@@ -16,7 +16,7 @@ type Values = {
"h-captcha-response": string; "h-captcha-response": string;
}; };
type ContactFormProps = { export type ContactFormProps = {
className?: string; className?: string;
}; };

View File

@@ -2,7 +2,7 @@ import classNames from "classnames";
import styles from "./Content.module.css"; import styles from "./Content.module.css";
type ContentProps = JSX.IntrinsicElements["div"]; export type ContentProps = JSX.IntrinsicElements["div"];
const Content = ({ className, ...rest }: ContentProps) => ( const Content = ({ className, ...rest }: ContentProps) => (
<div className={classNames(styles.content, className)} {...rest} /> <div className={classNames(styles.content, className)} {...rest} />

View File

@@ -7,7 +7,7 @@ import type { ReactNode, Ref } from "react";
import styles from "./CopyButton.module.css"; import styles from "./CopyButton.module.css";
type CopyButtonProps = { export type CopyButtonProps = {
source: ReactNode; source: ReactNode;
timeout?: number; timeout?: number;
className?: string; className?: string;

View File

@@ -6,7 +6,7 @@ import type { ImageProps as NextImageProps } from "next/image";
import styles from "./Figure.module.css"; import styles from "./Figure.module.css";
type FigureProps = Omit<NextImageProps, "alt"> & export type FigureProps = Omit<NextImageProps, "alt"> &
PropsWithChildren<{ PropsWithChildren<{
alt?: string; // becomes optional -- pulled from plaintext-ified caption if missing alt?: string; // becomes optional -- pulled from plaintext-ified caption if missing
}>; }>;

View File

@@ -6,7 +6,7 @@ import * as config from "../../lib/config";
import styles from "./Footer.module.css"; import styles from "./Footer.module.css";
type FooterProps = JSX.IntrinsicElements["footer"]; export type FooterProps = JSX.IntrinsicElements["footer"];
const Footer = ({ className, ...rest }: FooterProps) => ( const Footer = ({ className, ...rest }: FooterProps) => (
<footer className={classNames(styles.footer, className)} {...rest}> <footer className={classNames(styles.footer, className)} {...rest}>

View File

@@ -5,7 +5,7 @@ import Menu from "../Menu/Menu";
import styles from "./Header.module.css"; import styles from "./Header.module.css";
type HeaderProps = JSX.IntrinsicElements["header"] & { export type HeaderProps = JSX.IntrinsicElements["header"] & {
sticky?: boolean; sticky?: boolean;
}; };

View File

@@ -4,7 +4,7 @@ import type { HTMLAttributes } from "react";
import styles from "./Heading.module.css"; import styles from "./Heading.module.css";
type HeadingProps = HTMLAttributes<HTMLHeadingElement> & { export type HeadingProps = HTMLAttributes<HTMLHeadingElement> & {
as: "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; as: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
}; };

View File

@@ -2,7 +2,7 @@ import useSWR from "swr";
import Loading from "../Loading/Loading"; import Loading from "../Loading/Loading";
import { fetcher } from "../../lib/fetcher"; import { fetcher } from "../../lib/fetcher";
type HitCounterProps = { export type HitCounterProps = {
slug: string; slug: string;
className?: string; className?: string;
}; };

View File

@@ -2,7 +2,7 @@ import classNames from "classnames";
import styles from "./HorizontalRule.module.css"; import styles from "./HorizontalRule.module.css";
type HorizontalRuleProps = JSX.IntrinsicElements["hr"]; export type HorizontalRuleProps = JSX.IntrinsicElements["hr"];
const HorizontalRule = ({ className, ...rest }: HorizontalRuleProps) => ( const HorizontalRule = ({ className, ...rest }: HorizontalRuleProps) => (
<hr className={classNames(styles.hr, className)} {...rest} /> <hr className={classNames(styles.hr, className)} {...rest} />

View File

@@ -2,7 +2,7 @@ import classNames from "classnames";
import styles from "./IFrame.module.css"; import styles from "./IFrame.module.css";
type IFrameProps = JSX.IntrinsicElements["iframe"] & { export type IFrameProps = JSX.IntrinsicElements["iframe"] & {
src: string; src: string;
height: number; height: number;
width?: number; // defaults to 100% width?: number; // defaults to 100%

View File

@@ -8,7 +8,7 @@ import themes, { toCSS } from "../../lib/config/themes";
import styles from "./Layout.module.css"; import styles from "./Layout.module.css";
type LayoutProps = JSX.IntrinsicElements["div"] & { export type LayoutProps = JSX.IntrinsicElements["div"] & {
container?: boolean; // pass false to disable default `<main>` container styles with padding, etc. container?: boolean; // pass false to disable default `<main>` container styles with padding, etc.
stickyHeader?: boolean; // pass false to override default stickiness of header when scrolling stickyHeader?: boolean; // pass false to override default stickiness of header when scrolling
}; };

View File

@@ -3,7 +3,7 @@ import classNames from "classnames";
import styles from "./Loading.module.css"; import styles from "./Loading.module.css";
type LoadingProps = { export type LoadingProps = {
width: number; // of entire container, in pixels width: number; // of entire container, in pixels
boxes?: number; // total number of boxes (default: 3) boxes?: number; // total number of boxes (default: 3)
timing?: number; // staggered timing between each box's pulse, in seconds (default: 0.1s) timing?: number; // staggered timing between each box's pulse, in seconds (default: 0.1s)

View File

@@ -6,7 +6,7 @@ import { menuLinks } from "../../lib/config/menu";
import styles from "./Menu.module.css"; import styles from "./Menu.module.css";
type MenuProps = { export type MenuProps = {
className?: string; className?: string;
}; };

View File

@@ -8,7 +8,7 @@ import type { NoteMetaType } from "../../types";
import styles from "./NoteMeta.module.css"; import styles from "./NoteMeta.module.css";
import Link from "next/link"; import Link from "next/link";
type NoteMetaProps = Pick<NoteMetaType, "slug" | "date" | "title" | "tags">; export type NoteMetaProps = Pick<NoteMetaType, "slug" | "date" | "title" | "tags">;
const NoteMeta = ({ slug, date, title, tags = [] }: NoteMetaProps) => ( const NoteMeta = ({ slug, date, title, tags = [] }: NoteMetaProps) => (
<div className={styles.meta}> <div className={styles.meta}>

View File

@@ -4,7 +4,7 @@ import type { NoteMetaType } from "../../types";
import styles from "./NoteTitle.module.css"; import styles from "./NoteTitle.module.css";
type NoteTitleProps = Pick<NoteMetaType, "slug" | "htmlTitle"> & JSX.IntrinsicElements["h1"]; export type NoteTitleProps = Pick<NoteMetaType, "slug" | "htmlTitle"> & JSX.IntrinsicElements["h1"];
const NoteTitle = ({ slug, htmlTitle, className, ...rest }: NoteTitleProps) => ( const NoteTitle = ({ slug, htmlTitle, className, ...rest }: NoteTitleProps) => (
<h1 className={classNames(styles.title, className)} {...rest}> <h1 className={classNames(styles.title, className)} {...rest}>

View File

@@ -4,7 +4,7 @@ import type { NoteMetaType } from "../../types";
import styles from "./NotesList.module.css"; import styles from "./NotesList.module.css";
type NotesListProps = { export type NotesListProps = {
notesByYear: Record<string, NoteMetaType[]>; notesByYear: Record<string, NoteMetaType[]>;
}; };

View File

@@ -3,7 +3,7 @@ import { OctocatOcticon } from "../Icons";
import styles from "./OctocatLink.module.css"; import styles from "./OctocatLink.module.css";
type OctocatLinkProps = JSX.IntrinsicElements["a"] & { export type OctocatLinkProps = JSX.IntrinsicElements["a"] & {
repo: string; repo: string;
}; };

View File

@@ -5,7 +5,7 @@ import { baseUrl } from "../../lib/config";
import styles from "./PageTitle.module.css"; import styles from "./PageTitle.module.css";
type PageTitleProps = JSX.IntrinsicElements["h1"]; export type PageTitleProps = JSX.IntrinsicElements["h1"];
const PageTitle = ({ className, children, ...rest }: PageTitleProps) => { const PageTitle = ({ className, children, ...rest }: PageTitleProps) => {
const router = useRouter(); const router = useRouter();

View File

@@ -6,7 +6,7 @@ import type { RepoType } from "../../types";
import styles from "./RepositoryCard.module.css"; import styles from "./RepositoryCard.module.css";
type RepositoryCardProps = RepoType & { export type RepositoryCardProps = RepoType & {
className?: string; className?: string;
}; };

View File

@@ -7,7 +7,7 @@ import styles from "./Selfie.module.css";
import selfieJpg from "../../public/static/images/selfie.jpg"; import selfieJpg from "../../public/static/images/selfie.jpg";
type SelfieProps = { export type SelfieProps = {
className?: string; className?: string;
}; };

View File

@@ -4,7 +4,7 @@ import type { Ref } from "react";
import styles from "./Terminal.module.css"; import styles from "./Terminal.module.css";
type TerminalProps = JSX.IntrinsicElements["div"]; export type TerminalProps = JSX.IntrinsicElements["div"];
// a DOS-style terminal box with dynamic text // a DOS-style terminal box with dynamic text
const Terminal = forwardRef(function Terminal({ className, ...rest }: TerminalProps, ref: Ref<HTMLSpanElement>) { const Terminal = forwardRef(function Terminal({ className, ...rest }: TerminalProps, ref: Ref<HTMLSpanElement>) {

View File

@@ -4,7 +4,7 @@ import { SunIcon, MoonIcon } from "../Icons";
import styles from "./ThemeToggle.module.css"; import styles from "./ThemeToggle.module.css";
type ThemeToggleProps = { export type ThemeToggleProps = {
className?: string; className?: string;
}; };

View File

@@ -1,6 +1,6 @@
import Tweet from "react-tweet-embed"; import Tweet from "react-tweet-embed";
type TweetEmbedProps = { export type TweetEmbedProps = {
id: string; id: string;
options?: object; options?: object;
className?: string; className?: string;

View File

@@ -5,7 +5,7 @@ import Terminal from "../Terminal/Terminal";
import styles from "./VNC.module.css"; import styles from "./VNC.module.css";
type VNCProps = { export type VNCProps = {
server: string; server: string;
}; };

View File

@@ -4,7 +4,7 @@ import type { FilePlayerProps } from "react-player/file";
import styles from "./Video.module.css"; import styles from "./Video.module.css";
type VideoProps = Partial<FilePlayerProps> & { export type VideoProps = Partial<FilePlayerProps> & {
webm?: string; webm?: string;
mp4?: string; mp4?: string;
thumbnail?: string; thumbnail?: string;

View File

@@ -3,7 +3,7 @@ import classNames from "classnames";
import styles from "./Wallpaper.module.css"; import styles from "./Wallpaper.module.css";
type WallpaperProps = JSX.IntrinsicElements["main"] & { export type WallpaperProps = JSX.IntrinsicElements["main"] & {
image: string; image: string;
tile?: boolean; tile?: boolean;
}; };

View File

@@ -4,7 +4,7 @@ import type { YouTubePlayerProps } from "react-player/youtube";
import styles from "./YouTubeEmbed.module.css"; import styles from "./YouTubeEmbed.module.css";
type YouTubeEmbedProps = Partial<YouTubePlayerProps> & { export type YouTubeEmbedProps = Partial<YouTubePlayerProps> & {
id: string; id: string;
className?: string; className?: string;
}; };

View File

@@ -9,7 +9,7 @@ import * as config from "../lib/config";
import { defaultSeo, socialProfileJsonLd } from "../lib/config/seo"; import { defaultSeo, socialProfileJsonLd } from "../lib/config/seo";
import type { ReactElement, ReactNode } from "react"; import type { ReactElement, ReactNode } from "react";
import type { NextPage } from "next"; import type { NextPage } from "next";
import type { AppProps } from "next/app"; import type { AppProps as NextAppProps } from "next/app";
// global webfonts -- imported here so they're processed through PostCSS // global webfonts -- imported here so they're processed through PostCSS
import "@fontsource/inter/latin-400.css"; import "@fontsource/inter/latin-400.css";
@@ -29,13 +29,13 @@ import "../styles/typography.css";
import "../styles/index.css"; import "../styles/index.css";
// https://nextjs.org/docs/basic-features/layouts#with-typescript // https://nextjs.org/docs/basic-features/layouts#with-typescript
type Props = AppProps & { export type AppProps = NextAppProps & {
Component: NextPage & { Component: NextPage & {
getLayout?: (page: ReactElement) => ReactNode; getLayout?: (page: ReactElement) => ReactNode;
}; };
}; };
const App = ({ Component, pageProps }: Props) => { const App = ({ Component, pageProps }: AppProps) => {
const router = useRouter(); const router = useRouter();
// get this page's URL with full domain, and hack around query parameters and anchors // get this page's URL with full domain, and hack around query parameters and anchors