feat: style add new app connection
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
fdfad28c2e
commit
fc85716d07
@@ -1,10 +1,11 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useQuery } from '@apollo/client';
|
import { useQuery } from '@apollo/client';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { useTheme } from '@mui/material/styles';
|
||||||
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
||||||
import DialogTitle from '@mui/material/DialogTitle';
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
import DialogContent from '@mui/material/DialogContent';
|
import DialogContent from '@mui/material/DialogContent';
|
||||||
import Dialog from '@mui/material/Dialog';
|
import Dialog from '@mui/material/Dialog';
|
||||||
import TextField from '@mui/material/TextField';
|
|
||||||
import SearchIcon from '@mui/icons-material/Search';
|
import SearchIcon from '@mui/icons-material/Search';
|
||||||
import InputAdornment from '@mui/material/InputAdornment';
|
import InputAdornment from '@mui/material/InputAdornment';
|
||||||
import List from '@mui/material/List';
|
import List from '@mui/material/List';
|
||||||
@@ -12,6 +13,9 @@ import ListItem from '@mui/material/ListItem';
|
|||||||
import ListItemButton from '@mui/material/ListItemButton';
|
import ListItemButton from '@mui/material/ListItemButton';
|
||||||
import ListItemIcon from '@mui/material/ListItemIcon';
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
||||||
import ListItemText from '@mui/material/ListItemText';
|
import ListItemText from '@mui/material/ListItemText';
|
||||||
|
import InputLabel from '@mui/material/InputLabel';
|
||||||
|
import OutlinedInput from '@mui/material/OutlinedInput';
|
||||||
|
import FormControl from '@mui/material/FormControl';
|
||||||
|
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
import AppIcon from 'components/AppIcon';
|
import AppIcon from 'components/AppIcon';
|
||||||
@@ -25,30 +29,46 @@ type AddNewAppConnectionProps = {
|
|||||||
|
|
||||||
export default function AddNewAppConnection(props: AddNewAppConnectionProps){
|
export default function AddNewAppConnection(props: AddNewAppConnectionProps){
|
||||||
const { onClose } = props;
|
const { onClose } = props;
|
||||||
|
const theme = useTheme();
|
||||||
|
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('sm'));
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const [appName, setAppName] = useState<string | null>(null);
|
const [appName, setAppName] = useState<string | null>(null);
|
||||||
const { data } = useQuery(GET_APPS, { variables: {name: appName } });
|
const { data } = useQuery(GET_APPS, { variables: {name: appName } });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={true} onClose={onClose} maxWidth="sm" fullWidth>
|
<Dialog open={true} onClose={onClose} maxWidth="sm" fullWidth>
|
||||||
<DialogTitle>{formatMessage('apps.addNewAppConnection')}</DialogTitle>
|
<DialogTitle>
|
||||||
|
{formatMessage('apps.addNewAppConnection')}
|
||||||
|
</DialogTitle>
|
||||||
|
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<TextField
|
<FormControl
|
||||||
|
variant="outlined"
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="filled"
|
sx={{ mt: 2 }}
|
||||||
label={formatMessage('apps.searchApp')}
|
size={matchSmallScreens ? 'small' : 'medium'}
|
||||||
onChange={(event) => setAppName(event.target.value)}
|
>
|
||||||
InputProps={{
|
<InputLabel
|
||||||
startAdornment: (
|
htmlFor="search-app"
|
||||||
<InputAdornment position="start">
|
>
|
||||||
<SearchIcon />
|
{formatMessage('apps.searchApp')}
|
||||||
</InputAdornment>
|
</InputLabel>
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<List>
|
<OutlinedInput
|
||||||
|
id="search-app"
|
||||||
|
type="text"
|
||||||
|
fullWidth
|
||||||
|
onChange={(event) => setAppName(event.target.value)}
|
||||||
|
endAdornment={
|
||||||
|
<InputAdornment position="end">
|
||||||
|
<SearchIcon sx={{ color: (theme) => theme.palette.primary.main }} />
|
||||||
|
</InputAdornment>
|
||||||
|
}
|
||||||
|
label={formatMessage('apps.searchApp')}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
|
||||||
|
<List sx={{ pt: 2 }}>
|
||||||
{data?.getApps?.map((app: App) => (
|
{data?.getApps?.map((app: App) => (
|
||||||
<ListItem disablePadding key={app.name}>
|
<ListItem disablePadding key={app.name}>
|
||||||
<ListItemButton component={Link} to={URLS.APP_ADD_CONNECTION(app.name.toLowerCase())}>
|
<ListItemButton component={Link} to={URLS.APP_ADD_CONNECTION(app.name.toLowerCase())}>
|
||||||
|
@@ -176,6 +176,13 @@ const extendedTheme = createTheme({
|
|||||||
elevation: 2,
|
elevation: 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
MuiBackdrop: {
|
||||||
|
styleOverrides: {
|
||||||
|
root: {
|
||||||
|
background: 'rgba(0, 8, 20, 0.64)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
MuiButton: {
|
MuiButton: {
|
||||||
styleOverrides: {
|
styleOverrides: {
|
||||||
root: {
|
root: {
|
||||||
@@ -221,6 +228,21 @@ const extendedTheme = createTheme({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
MuiDialog: {
|
||||||
|
styleOverrides: {
|
||||||
|
paperWidthSm: {
|
||||||
|
margin: referenceTheme.spacing(4, 3),
|
||||||
|
width: `calc(100% - ${referenceTheme.spacing(6)})`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
MuiDialogTitle: {
|
||||||
|
styleOverrides: {
|
||||||
|
root: {
|
||||||
|
paddingTop: referenceTheme.spacing(3),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
MuiToolbar: {
|
MuiToolbar: {
|
||||||
styleOverrides: {
|
styleOverrides: {
|
||||||
root: {
|
root: {
|
||||||
|
Reference in New Issue
Block a user