Skip to content

Commit 401cd08

Browse files
committed
fix showing bottom navigation on mobile
1 parent e4b39fa commit 401cd08

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

src/components/AppContentLayout.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,20 @@ import PreferencesContext from '../preferences/PreferencesContext'
44
import BottomNavigation from './BottomNavigation'
55
import { isDesktop } from 'react-device-detect'
66

7-
function MobileCards({ setShowSettings }) {
8-
const { cards } = useContext(PreferencesContext)
9-
const [selectedCard, setSelectedCard] = useState(cards[0])
7+
function MobileCards({ selectedCard }) {
108
const currentCard = SUPPORTED_CARDS.find((c) => c.value === selectedCard.name)
11-
129
return (
13-
<>
14-
{currentCard &&
15-
React.createElement(currentCard.component, {
16-
key: currentCard.value,
17-
label: currentCard.label,
18-
analyticsTag: currentCard.analyticsTag,
19-
withAds: false,
20-
})}
21-
<BottomNavigation
22-
selectedCard={selectedCard}
23-
setSelectedCard={setSelectedCard}
24-
setShowSettings={setShowSettings}
25-
/>
26-
</>
10+
currentCard &&
11+
React.createElement(currentCard.component, {
12+
key: currentCard.value,
13+
label: currentCard.label,
14+
analyticsTag: currentCard.analyticsTag,
15+
withAds: true,
16+
})
2717
)
2818
}
2919

30-
function DesktopCards({}) {
31-
const { cards } = useContext(PreferencesContext)
20+
function DesktopCards({ cards }) {
3221
return cards.map((card, index) => {
3322
const constantCard = SUPPORTED_CARDS.find((c) => c.value === card.name)
3423
return React.createElement(constantCard.component, {
@@ -42,10 +31,21 @@ function DesktopCards({}) {
4231
}
4332

4433
function AppContentLayout({ setShowSettings }) {
34+
const { cards } = useContext(PreferencesContext)
35+
const [selectedCard, setSelectedCard] = useState(cards[0])
36+
4537
return (
46-
<main className="AppContent scrollable">
47-
{isDesktop ? <DesktopCards /> : <MobileCards setShowSettings={setShowSettings} />}
48-
</main>
38+
<>
39+
<main className="AppContent scrollable">
40+
{isDesktop ? <DesktopCards cards={cards} /> : <MobileCards selectedCard={selectedCard} />}
41+
</main>
42+
43+
<BottomNavigation
44+
selectedCard={selectedCard}
45+
setSelectedCard={setSelectedCard}
46+
setShowSettings={setShowSettings}
47+
/>
48+
</>
4949
)
5050
}
5151

0 commit comments

Comments
 (0)