fix typecheck
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user