Skip to content

Commit b8d116c

Browse files
fix: omit the hamburger from the left of the appbar when on the list page
1 parent 6eb42f1 commit b8d116c

1 file changed

Lines changed: 67 additions & 54 deletions

File tree

src/layouts/index.js

Lines changed: 67 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ import {
2424
} from "../context/CurrencyContext"
2525
import Button from "@mui/material/Button"
2626

27-
function CurrencySelector() {
27+
function CurrencySelector({ isDark = false }) {
2828
const { currency, setCurrency, usedCurrencies } = useCurrency()
2929

3030
return (
3131
<Box component="div" sx={{ display: `flex`, alignItems: `center` }}>
3232
<InputLabel
3333
sx={{
34-
color: `white`,
34+
color: isDark ? `inherit` : `white`,
3535
}}
3636
>
3737
Currency
@@ -41,11 +41,11 @@ function CurrencySelector() {
4141
onChange={(e) => setCurrency(e.target.value)}
4242
variant="standard"
4343
sx={{
44-
color: `white`,
44+
color: isDark ? `inherit` : `white`,
4545
marginLeft: theme.spacing(2),
46-
"&:before": { borderColor: `white` },
47-
"&:after": { borderColor: `white` },
48-
"& .MuiSvgIcon-root": { color: `white` },
46+
"&:before": { borderColor: isDark ? `rgba(0, 0, 0, 0.42)` : `white` },
47+
"&:after": { borderColor: isDark ? `primary.main` : `white` },
48+
"& .MuiSvgIcon-root": { color: isDark ? `inherit` : `white` },
4949
}}
5050
>
5151
<MenuItem value="Original">Original</MenuItem>
@@ -62,8 +62,7 @@ function CurrencySelector() {
6262
const LayoutInner = ({ children }) => {
6363
const isRoot =
6464
typeof location !== `undefined` && location && location.pathname === `/`
65-
// Check if the screen size is small enough to trigger the dropdown (e.g., < 600px)
66-
useMediaQuery(theme.breakpoints.down(`sm`))
65+
const isMobile = useMediaQuery(theme.breakpoints.down(`sm`))
6766
const [dropdownAnchorEl, setDropdownAnchorEl] = useState(null)
6867
const isDropdownOpen = Boolean(dropdownAnchorEl)
6968

@@ -82,53 +81,68 @@ const LayoutInner = ({ children }) => {
8281
<CssBaseline />
8382
<AppBar position="static">
8483
<Toolbar>
85-
<IconButton
86-
edge="start"
87-
sx={{ marginRight: theme.spacing(2) }}
88-
color="inherit"
89-
aria-label="menu"
90-
onClick={() => {
91-
if (!isRoot) {
84+
{!isRoot && (
85+
<IconButton
86+
edge="start"
87+
sx={{ marginRight: theme.spacing(2) }}
88+
color="inherit"
89+
aria-label="menu"
90+
onClick={() => {
9291
navigate(`/`)
93-
}
94-
}}
95-
>
96-
{isRoot ? <MenuIcon /> : <BackIcon />}
97-
</IconButton>
92+
}}
93+
>
94+
<BackIcon />
95+
</IconButton>
96+
)}
9897
<Typography variant="h6" sx={{ flexGrow: 1 }}>
9998
IoST Index
10099
</Typography>
101100
<Box component="div" sx={{ display: `flex`, alignItems: `center` }}>
102-
<CurrencySelector />
103-
<Button color="inherit" onClick={() => navigate(`/about`)}>
104-
About
105-
</Button>
106-
<Button
107-
variant="contained"
108-
title="Become a Patron!"
109-
href={`https://www.patreon.com/bePatron?u=6548129`}
110-
sx={{ backgroundColor: `#f46758`, borderColor: `#f46758` }}
111-
startIcon={
112-
<SvgIcon>
113-
<g
114-
transform="matrix(0.2400288,0,0,0.2400288,-0.00288035,-0.02400288)"
115-
fill="#000000"
116-
fillRule="evenodd"
117-
>
118-
<path
119-
d="m 64.1102,0.1004 c -19.8512,0 -36.0016,16.1482 -36.0016,35.9982 0,19.7898 16.1504,35.8904 36.0016,35.8904 C 83.9,71.989 100,55.8884 100,36.0986 100,16.2486 83.9,0.1004 64.1102,0.1004"
120-
fill="#fff"
121-
/>
122-
<polygon
123-
points="0.012,95.988 17.59,95.988 17.59,0.1 0.012,0.1 "
124-
fill="#0a2f49"
125-
/>
126-
</g>
127-
</SvgIcon>
128-
}
129-
>
130-
Become a Patron!
131-
</Button>
101+
{!isMobile && (
102+
<>
103+
<CurrencySelector />
104+
<Button color="inherit" onClick={() => navigate(`/about`)}>
105+
About
106+
</Button>
107+
<Button
108+
variant="contained"
109+
title="Become a Patron!"
110+
href={`https://www.patreon.com/bePatron?u=6548129`}
111+
sx={{ backgroundColor: `#f46758`, borderColor: `#f46758` }}
112+
startIcon={
113+
<SvgIcon>
114+
<g
115+
transform="matrix(0.2400288,0,0,0.2400288,-0.00288035,-0.02400288)"
116+
fill="#000000"
117+
fillRule="evenodd"
118+
>
119+
<path
120+
d="m 64.1102,0.1004 c -19.8512,0 -36.0016,16.1482 -36.0016,35.9982 0,19.7898 16.1504,35.8904 36.0016,35.8904 C 83.9,71.989 100,55.8884 100,36.0986 100,16.2486 83.9,0.1004 64.1102,0.1004"
121+
fill="#fff"
122+
/>
123+
<polygon
124+
points="0.012,95.988 17.59,95.988 17.59,0.1 0.012,0.1 "
125+
fill="#0a2f49"
126+
/>
127+
</g>
128+
</SvgIcon>
129+
}
130+
>
131+
Become a Patron!
132+
</Button>
133+
</>
134+
)}
135+
136+
{isMobile && (
137+
<IconButton
138+
color="inherit"
139+
aria-label="open drawer"
140+
edge="end"
141+
onClick={(e) => setDropdownAnchorEl(e.currentTarget)}
142+
>
143+
<MenuIcon />
144+
</IconButton>
145+
)}
132146

133147
{/* The actual dropdown menu component (using MUI's Menu) */}
134148
<Menu
@@ -137,15 +151,14 @@ const LayoutInner = ({ children }) => {
137151
anchorOrigin={{ vertical: `bottom`, horizontal: `right` }}
138152
keepMounted
139153
transformOrigin={{ vertical: `top`, horizontal: `right` }}
140-
sx={{
141-
display: `block`,
142-
}}
143154
open={isDropdownOpen}
144155
onClose={() => {
145156
setDropdownAnchorEl(null)
146157
}}
147158
>
148-
<CurrencySelector />
159+
<MenuItem disableRipple sx={{ cursor: `default`, "&:hover": { backgroundColor: `transparent` } }}>
160+
<CurrencySelector isDark={true} />
161+
</MenuItem>
149162
<MenuItem
150163
onClick={() => {
151164
navigate(`/about`)

0 commit comments

Comments
 (0)