aboutsummaryrefslogtreecommitdiffstats
path: root/packages/renderer/src/components/locationBar/NavigationButtons.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/renderer/src/components/locationBar/NavigationButtons.tsx')
-rw-r--r--packages/renderer/src/components/locationBar/NavigationButtons.tsx75
1 files changed, 75 insertions, 0 deletions
diff --git a/packages/renderer/src/components/locationBar/NavigationButtons.tsx b/packages/renderer/src/components/locationBar/NavigationButtons.tsx
new file mode 100644
index 0000000..82ed657
--- /dev/null
+++ b/packages/renderer/src/components/locationBar/NavigationButtons.tsx
@@ -0,0 +1,75 @@
1/*
2 * Copyright (C) 2022 Kristóf Marussy <kristof@marussy.com>
3 *
4 * This file is part of Sophie.
5 *
6 * Sophie is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: AGPL-3.0-only
19 */
20
21import IconArrowBack from '@mui/icons-material/ArrowBack';
22import IconArrowForward from '@mui/icons-material/ArrowForward';
23import IconStop from '@mui/icons-material/Close';
24import IconHome from '@mui/icons-material/HomeOutlined';
25import IconRefresh from '@mui/icons-material/Refresh';
26import Box from '@mui/material/Box';
27import IconButton from '@mui/material/IconButton';
28import { Service } from '@sophie/shared';
29import { observer } from 'mobx-react-lite';
30import React from 'react';
31
32function NavigationButtons({
33 service,
34}: {
35 service: Service | undefined;
36}): JSX.Element {
37 return (
38 <Box
39 sx={{
40 display: 'flex',
41 flexDirection: 'row',
42 }}
43 >
44 <IconButton
45 aria-label="Go back"
46 disabled={service === undefined || !service.canGoBack}
47 >
48 <IconArrowBack />
49 </IconButton>
50 <IconButton
51 aria-label="Go forward"
52 disabled={service === undefined || !service.canGoForward}
53 >
54 <IconArrowForward />
55 </IconButton>
56 {service?.state === 'loading' ? (
57 <IconButton aria-label="Stop">
58 <IconStop />
59 </IconButton>
60 ) : (
61 <IconButton aria-label="Refresh" disabled={service === undefined}>
62 <IconRefresh />
63 </IconButton>
64 )}
65 <IconButton
66 aria-label="Go to service homepage"
67 disabled={service === undefined}
68 >
69 <IconHome />
70 </IconButton>
71 </Box>
72 );
73}
74
75export default observer(NavigationButtons);