From a0f3515981be7ae1b6fab2ed3de1726cb75c6f8a Mon Sep 17 00:00:00 2001 From: Uriel Date: Sat, 25 Feb 2023 11:29:16 -0300 Subject: [PATCH] Use CSS selectors instead of an if in react for MainLayout buttons (#605) --- .../components/ClearDriftCompensationButton.tsx | 13 +++++++++---- gui/src/components/MainLayout.tsx | 12 +++++------- gui/src/components/commons/icon/TrashIcon.tsx | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 gui/src/components/commons/icon/TrashIcon.tsx diff --git a/gui/src/components/ClearDriftCompensationButton.tsx b/gui/src/components/ClearDriftCompensationButton.tsx index 4caf687c60..cb3ce2c3bb 100644 --- a/gui/src/components/ClearDriftCompensationButton.tsx +++ b/gui/src/components/ClearDriftCompensationButton.tsx @@ -1,7 +1,8 @@ import { useLocalization } from '@fluent/react'; import { ClearDriftCompensationRequestT, RpcMessage } from 'solarxr-protocol'; import { useWebsocketAPI } from '../hooks/websocket-api'; -import { Button } from './commons/Button'; +import { BigButton } from './commons/BigButton'; +import { TrashIcon } from './commons/icon/TrashIcon'; export function ClearDriftCompensationButton() { const { l10n } = useLocalization(); @@ -13,8 +14,12 @@ export function ClearDriftCompensationButton() { }; return ( - + } + onClick={clearDriftCompensation} + > + {} + ); } diff --git a/gui/src/components/MainLayout.tsx b/gui/src/components/MainLayout.tsx index b1b76a8877..38e90e8654 100644 --- a/gui/src/components/MainLayout.tsx +++ b/gui/src/components/MainLayout.tsx @@ -63,7 +63,7 @@ export function MainLayoutRoute({ {widgets && (
-
+
)} - + + {driftCompensationEnabled && ( + + )}
- {driftCompensationEnabled && ( - - )}
diff --git a/gui/src/components/commons/icon/TrashIcon.tsx b/gui/src/components/commons/icon/TrashIcon.tsx new file mode 100644 index 0000000000..74c87d7ee4 --- /dev/null +++ b/gui/src/components/commons/icon/TrashIcon.tsx @@ -0,0 +1,16 @@ +export function TrashIcon({ width = 33 }: { width: number }) { + return ( + + + + ); +}