From 60f2b0d9997092c3489bc3879ec7d7c0003e7900 Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Sat, 19 Feb 2022 23:34:07 +1100 Subject: [PATCH] Add update button and tooltips to IconButtons --- src/components/generic/Modal.tsx | 7 +++- src/components/generic/button/IconButton.tsx | 42 ++++++++++++-------- src/components/menu/BottomNavItem.tsx | 2 +- src/components/modals/VersionInfo.tsx | 19 +++++++-- 4 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/components/generic/Modal.tsx b/src/components/generic/Modal.tsx index b48f35af..0eabe2e8 100644 --- a/src/components/generic/Modal.tsx +++ b/src/components/generic/Modal.tsx @@ -11,12 +11,14 @@ import { Card } from './Card'; export interface ModalProps { title: string; onClose: () => void; + actions?: React.ReactNode; children: React.ReactNode; } export const Modal = ({ title, onClose, + actions, children, }: ModalProps): JSX.Element => { const darkMode = useAppSelector((state) => state.app.darkMode); @@ -43,7 +45,10 @@ export const Modal = ({
{title}
- } onClick={onClose} /> +
+ {actions} + } onClick={onClose} /> +
{children} diff --git a/src/components/generic/button/IconButton.tsx b/src/components/generic/button/IconButton.tsx index 2b645f99..b63bfe85 100644 --- a/src/components/generic/button/IconButton.tsx +++ b/src/components/generic/button/IconButton.tsx @@ -1,35 +1,43 @@ import type React from 'react'; +import { Tooltip } from '@components/generic/Tooltip'; + type DefaulButtonProps = JSX.IntrinsicElements['button']; export interface IconButtonProps extends DefaulButtonProps { icon: React.ReactNode; + tooltip?: string; active?: boolean; } export const IconButton = ({ icon, active, + tooltip, disabled, ...props }: IconButtonProps): JSX.Element => { return ( -
- -
+ +
+ +
+
); }; diff --git a/src/components/menu/BottomNavItem.tsx b/src/components/menu/BottomNavItem.tsx index 65cb62c2..a37f97d7 100644 --- a/src/components/menu/BottomNavItem.tsx +++ b/src/components/menu/BottomNavItem.tsx @@ -18,7 +18,7 @@ export const BottomNavItem = ({ children, }: BottomNavItemProps) => { return ( - +
{ + const appState = useAppSelector((state) => state.app); const dispatch = useAppDispatch(); const { data } = useSWR( @@ -63,6 +69,13 @@ export const VersionInfo = ({ {visible && ( + } /> + + ) + } onClose={(): void => { onClose(); }}