diff options
Diffstat (limited to 'packages/renderer/src/components/locationBar/LocationTextField.tsx')
-rw-r--r-- | packages/renderer/src/components/locationBar/LocationTextField.tsx | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/packages/renderer/src/components/locationBar/LocationTextField.tsx b/packages/renderer/src/components/locationBar/LocationTextField.tsx new file mode 100644 index 0000000..a618bf6 --- /dev/null +++ b/packages/renderer/src/components/locationBar/LocationTextField.tsx | |||
@@ -0,0 +1,59 @@ | |||
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 | |||
21 | import IconGlobe from '@mui/icons-material/Public'; | ||
22 | import FilledInput from '@mui/material/FilledInput'; | ||
23 | import InputAdornment from '@mui/material/InputAdornment'; | ||
24 | import { Service } from '@sophie/shared'; | ||
25 | import { observer } from 'mobx-react-lite'; | ||
26 | import React from 'react'; | ||
27 | |||
28 | function LocationTextField({ | ||
29 | service, | ||
30 | }: { | ||
31 | service: Service | undefined; | ||
32 | }): JSX.Element { | ||
33 | return ( | ||
34 | <FilledInput | ||
35 | aria-label="Location" | ||
36 | inputProps={{ | ||
37 | spellCheck: false, | ||
38 | }} | ||
39 | size="small" | ||
40 | fullWidth | ||
41 | hiddenLabel | ||
42 | disableUnderline | ||
43 | sx={(theme) => ({ | ||
44 | borderRadius: 1, | ||
45 | '&.Mui-focused': { | ||
46 | outline: `2px solid ${theme.palette.primary.main}`, | ||
47 | }, | ||
48 | })} | ||
49 | startAdornment={ | ||
50 | <InputAdornment position="start"> | ||
51 | <IconGlobe fontSize="small" /> | ||
52 | </InputAdornment> | ||
53 | } | ||
54 | value={service?.currentUrl ?? ''} | ||
55 | /> | ||
56 | ); | ||
57 | } | ||
58 | |||
59 | export default observer(LocationTextField); | ||