From f32fc1105d43b713f40c3b2819ca14b11e989dc2 Mon Sep 17 00:00:00 2001
From: Kristóf Marussy <kristof@marussy.com>
Date: Sun, 15 May 2022 14:29:26 +0200
Subject: refactor(renderer): remove StoreProvider
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Use explicit prop threading to pass the MainStore to components, which
makes the data dependencies more explicit and enables better
testability.

Signed-off-by: Kristóf Marussy <kristof@marussy.com>
---
 .../src/components/sidebar/ToggleLocationBarButton.tsx      | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx')

diff --git a/packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx b/packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx
index c697170..b6644a3 100644
--- a/packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx
+++ b/packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx
@@ -27,7 +27,7 @@ import { observer } from 'mobx-react-lite';
 import React from 'react';
 import { useTranslation } from 'react-i18next';
 
-import { useStore } from '../StoreProvider';
+import type RendererStore from '../../stores/RendererStore';
 import { getLocaltionBarID } from '../locationBar/LocationBar';
 
 function ToggleLocationBarIcon({
@@ -45,12 +45,15 @@ function ToggleLocationBarIcon({
   return left ? <IconChevronLeft /> : <IconChevronRight />;
 }
 
-function ToggleLocationBarButton(): JSX.Element {
-  const { t } = useTranslation();
-  const {
+function ToggleLocationBarButton({
+  store: {
     shared: { locationBarVisible, canToggleLocationBar },
     settings,
-  } = useStore();
+  },
+}: {
+  store: RendererStore;
+}): JSX.Element {
+  const { t } = useTranslation();
   const { selectedService } = settings;
 
   return (
-- 
cgit v1.2.3-54-g00ecf

