src: use prop unpacking pattern

This makes the code a bit shorter by not having to use `props.` all of
the time. Also make everything VoidFunctionComponent while we are
touching this.
This commit is contained in:
David Lechner
2022-03-12 16:07:31 -06:00
parent 228ba4ebb8
commit 8e4045449c
18 changed files with 193 additions and 131 deletions
+6 -3
View File
@@ -24,7 +24,10 @@ import './about.scss';
type AboutDialogProps = { isOpen: boolean; onClose: () => void };
const AboutDialog: React.FunctionComponent<AboutDialogProps> = (props) => {
const AboutDialog: React.VoidFunctionComponent<AboutDialogProps> = ({
isOpen,
onClose,
}) => {
const [isLicenseDialogOpen, setIsLicenseDialogOpen] = useState(false);
const [i18n] = useI18n({ id: 'about', translations: { en }, fallback: en });
@@ -32,8 +35,8 @@ const AboutDialog: React.FunctionComponent<AboutDialogProps> = (props) => {
return (
<Dialog
title={`Pybricks v${firmwareVersion} (${appName} v${appVersion})`}
isOpen={props.isOpen}
onClose={props.onClose}
isOpen={isOpen}
onClose={onClose}
>
<div className={Classes.DIALOG_BODY}>
<div className="pb-about-icon">