fix typecheck

This commit is contained in:
Bastian Ike
2020-07-17 16:10:33 +02:00
committed by Bastian
parent be0f0a2cf0
commit 3adc5d3aaf
4 changed files with 12 additions and 60 deletions

View File

@@ -9,7 +9,7 @@ type BadgeProps = {
};
export default function Badge({ onClick, big, type, children }: React.PropsWithChildren<BadgeProps>) {
const Comp = typeof onClick ? 'a' : 'span';
const Comp = onClick ? 'a' : 'span';
return (
<Comp

View File

@@ -1,20 +1,14 @@
import {useState} from "react";
import {useEffect} from "react";
import {radarName} from "../config";
type SetTitleProps = {
title: string
onSetTitle?: (title: string) => void
}
export default function SetTitle({title, onSetTitle}: SetTitleProps) {
const [onSetTitleState, setOnSetTitleState] = useState(() => onSetTitle)
if (onSetTitle) {
setOnSetTitleState(onSetTitle)
}
if (onSetTitleState) {
onSetTitleState(title)
}
export default function SetTitle({title}: SetTitleProps) {
useEffect(() => {
document.title = `${title} | ${radarName}`
}, [title])
return null;
}