reformat with prettier with semicolons and tabs

This commit is contained in:
m5r
2021-07-31 23:57:43 +08:00
parent fc4278ca7b
commit 079241ddb0
80 changed files with 1187 additions and 1270 deletions

View File

@ -1,10 +1,10 @@
import { ReactNode } from "react"
import { Head } from "blitz"
import { ReactNode } from "react";
import { Head } from "blitz";
type LayoutProps = {
title?: string
children: ReactNode
}
title?: string;
children: ReactNode;
};
const BaseLayout = ({ title, children }: LayoutProps) => {
return (
@ -16,7 +16,7 @@ const BaseLayout = ({ title, children }: LayoutProps) => {
{children}
</>
)
}
);
};
export default BaseLayout
export default BaseLayout;

View File

@ -1,19 +1,19 @@
import type { ReactNode } from "react"
import Link from "next/link"
import { useRouter } from "next/router"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import type { ReactNode } from "react";
import Link from "next/link";
import { useRouter } from "next/router";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faPhoneAlt as fasPhone,
faTh as fasTh,
faComments as fasComments,
faCog as fasCog,
} from "@fortawesome/pro-solid-svg-icons"
} from "@fortawesome/pro-solid-svg-icons";
import {
faPhoneAlt as farPhone,
faTh as farTh,
faComments as farComments,
faCog as farCog,
} from "@fortawesome/pro-regular-svg-icons"
} from "@fortawesome/pro-regular-svg-icons";
export default function Footer() {
return (
@ -51,22 +51,22 @@ export default function Footer() {
}}
/>
</footer>
)
);
}
type NavLinkProps = {
path: string
label: string
path: string;
label: string;
icons: {
active: ReactNode
inactive: ReactNode
}
}
active: ReactNode;
inactive: ReactNode;
};
};
function NavLink({ path, label, icons }: NavLinkProps) {
const router = useRouter()
const isActiveRoute = router.pathname.startsWith(path)
const icon = isActiveRoute ? icons.active : icons.inactive
const router = useRouter();
const isActiveRoute = router.pathname.startsWith(path);
const icon = isActiveRoute ? icons.active : icons.inactive;
return (
<div className="flex flex-col items-center justify-around h-full">
@ -77,5 +77,5 @@ function NavLink({ path, label, icons }: NavLinkProps) {
</a>
</Link>
</div>
)
);
}

View File

@ -1,20 +1,20 @@
import type { ErrorInfo, FunctionComponent } from "react"
import { Component } from "react"
import Head from "next/head"
import type { WithRouterProps } from "next/dist/client/with-router"
import { withRouter } from "next/router"
import type { ErrorInfo, FunctionComponent } from "react";
import { Component } from "react";
import Head from "next/head";
import type { WithRouterProps } from "next/dist/client/with-router";
import { withRouter } from "next/router";
import appLogger from "../../../../integrations/logger"
import appLogger from "../../../../integrations/logger";
import Footer from "./footer"
import Footer from "./footer";
type Props = {
title: string
pageTitle?: string
hideFooter?: true
}
title: string;
pageTitle?: string;
hideFooter?: true;
};
const logger = appLogger.child({ module: "Layout" })
const logger = appLogger.child({ module: "Layout" });
const Layout: FunctionComponent<Props> = ({
children,
@ -41,33 +41,33 @@ const Layout: FunctionComponent<Props> = ({
</div>
</div>
</>
)
}
);
};
type ErrorBoundaryState =
| {
isError: false
isError: false;
}
| {
isError: true
errorMessage: string
}
isError: true;
errorMessage: string;
};
const ErrorBoundary = withRouter(
class ErrorBoundary extends Component<WithRouterProps, ErrorBoundaryState> {
public readonly state = {
isError: false,
} as const
} as const;
static getDerivedStateFromError(error: Error): ErrorBoundaryState {
return {
isError: true,
errorMessage: error.message,
}
};
}
public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
logger.error(error, errorInfo.componentStack)
logger.error(error, errorInfo.componentStack);
}
public render() {
@ -90,12 +90,12 @@ const ErrorBoundary = withRouter(
?
</p>
</>
)
);
}
return this.props.children
return this.props.children;
}
}
)
);
export default Layout
export default Layout;