mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
styling: Enforced styling across all files (#55)
This commit is contained in:
165 files changed
+1879
-1725
No files matched your search
@@ -1,14 +1,12 @@
|
||||
import React from 'react'
|
||||
import { AppWrapper } from "../../../ui/components";
|
||||
import { AppContent } from "../../../ui/components/AppContent";
|
||||
import React from 'react';
|
||||
import { AppWrapper } from '../../../ui/components';
|
||||
import { AppContent } from '../../../ui/components/AppContent';
|
||||
import { usePhotoModal } from '../hooks/usePhotoModal';
|
||||
import { GalleryGrid } from './grid/GalleryGrid';
|
||||
import { GalleryModal } from './modal/GalleryModal';
|
||||
|
||||
|
||||
const CameraApp = () => {
|
||||
|
||||
const {modal} = usePhotoModal();
|
||||
const { modal } = usePhotoModal();
|
||||
|
||||
return (
|
||||
<AppWrapper id='camera-app'>
|
||||
@@ -23,7 +21,7 @@ const CameraApp = () => {
|
||||
{!modal ? <GalleryGrid /> : null}
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export default CameraApp;
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import React from 'react';
|
||||
import { Box, Button } from '@material-ui/core';
|
||||
import useStyles from './grid.styles';
|
||||
import { usePhotos } from '../../hooks/usePhotos';
|
||||
@@ -10,48 +10,70 @@ import { usePhotoMeta } from '../../hooks/usePhotoMeta';
|
||||
// isMessage will work as a style handler kinda. If the gallery is rendered in the messages,
|
||||
// it will have the value true, which basically means a tweak on the design to fit in a modal
|
||||
export const GalleryGrid = (isMessags) => {
|
||||
const classes = useStyles()
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
const { setMeta } = usePhotoMeta();
|
||||
const { setModal } = usePhotoModal();
|
||||
|
||||
|
||||
const photos = usePhotos();
|
||||
|
||||
console.log(photos)
|
||||
console.log(photos);
|
||||
|
||||
const handleCamera = () => {
|
||||
Nui.send('phone:TakePhoto', {})
|
||||
}
|
||||
Nui.send('phone:TakePhoto', {});
|
||||
};
|
||||
|
||||
const handlePhotoOpen = (photo) => {
|
||||
setModal(true)
|
||||
setMeta(photo)
|
||||
}
|
||||
setModal(true);
|
||||
setMeta(photo);
|
||||
};
|
||||
|
||||
if(!photos) return (
|
||||
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}>
|
||||
if (!photos)
|
||||
return (
|
||||
<Box
|
||||
display='flex'
|
||||
flexWrap='wrap'
|
||||
alignContent='flex-start'
|
||||
className={classes.root}
|
||||
>
|
||||
<Box>
|
||||
<Button onClick={handleCamera} style={{ borderRadius: 0 }} className={classes.photo}>
|
||||
<AddIcon fontSize="large"/>
|
||||
<Button
|
||||
onClick={handleCamera}
|
||||
style={{ borderRadius: 0 }}
|
||||
className={classes.photo}
|
||||
>
|
||||
<AddIcon fontSize='large' />
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}>
|
||||
<Box
|
||||
display='flex'
|
||||
flexWrap='wrap'
|
||||
alignContent='flex-start'
|
||||
className={classes.root}
|
||||
>
|
||||
<Box>
|
||||
<Button onClick={handleCamera} style={{ borderRadius: 0 }} className={classes.photo}>
|
||||
<AddIcon fontSize="large"/>
|
||||
<Button
|
||||
onClick={handleCamera}
|
||||
style={{ borderRadius: 0 }}
|
||||
className={classes.photo}
|
||||
>
|
||||
<AddIcon fontSize='large' />
|
||||
</Button>
|
||||
</Box>
|
||||
{photos.map(photo => (
|
||||
{photos.map((photo) => (
|
||||
<Box onClick={() => handlePhotoOpen(photo)}>
|
||||
<div style={{ backgroundImage: `url(${photo.image})` }} className={classes.photo} />
|
||||
<div
|
||||
style={{ backgroundImage: `url(${photo.image})` }}
|
||||
className={classes.photo}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -2,7 +2,7 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
root: {
|
||||
flexGrow: 1
|
||||
flexGrow: 1,
|
||||
},
|
||||
photo: {
|
||||
border: '1px inset #fff',
|
||||
@@ -13,7 +13,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
backgroundPosition: 'center',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
backgroundSize: 'cover',
|
||||
}
|
||||
}))
|
||||
},
|
||||
}));
|
||||
|
||||
export default useStyles;
|
||||
export default useStyles;
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import React from 'react';
|
||||
import { usePhotoMeta } from '../../hooks/usePhotoMeta';
|
||||
import { usePhotoModal } from '../../hooks/usePhotoModal';
|
||||
import useStyles from './modal.styles';
|
||||
@@ -12,49 +12,52 @@ import { ShareModal } from './ShareModal';
|
||||
import { useShareLink } from '../../hooks/useShareLink';
|
||||
|
||||
export const GalleryModal = () => {
|
||||
|
||||
const { meta, setMeta } = usePhotoMeta();
|
||||
const { modal, setModal } = usePhotoModal();
|
||||
const classes = useStyles();
|
||||
|
||||
const { shareModal ,setShareModal } = useShareModal();
|
||||
const { shareModal, setShareModal } = useShareModal();
|
||||
const { setShareLink } = useShareLink();
|
||||
|
||||
|
||||
const _handleClose = () => {
|
||||
setModal(false)
|
||||
setModal(false);
|
||||
setMeta(null);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeletePhoto = () => {
|
||||
console.log(meta.id)
|
||||
console.log(meta.id);
|
||||
Nui.send('photo:deletePhoto', {
|
||||
id: meta.id
|
||||
})
|
||||
setModal(false)
|
||||
}
|
||||
id: meta.id,
|
||||
});
|
||||
setModal(false);
|
||||
};
|
||||
|
||||
const handleSharePhoto = () => {
|
||||
setShareModal(true)
|
||||
setShareLink(meta.image)
|
||||
}
|
||||
|
||||
if(!meta) return null;
|
||||
setShareModal(true);
|
||||
setShareLink(meta.image);
|
||||
};
|
||||
|
||||
if (!meta) return null;
|
||||
|
||||
return (
|
||||
<Paper className={modal ? classes.modal : classes.modalHide}>
|
||||
<ShareModal key={meta.id} {...meta}/>
|
||||
<ShareModal key={meta.id} {...meta} />
|
||||
<div className={shareModal ? classes.backgroundModal : undefined} />
|
||||
<Button onClick={_handleClose}><ArrowBackIcon /></Button>
|
||||
<div className={classes.image} style={{ backgroundImage: `url(${meta.image})`}} />
|
||||
<Button onClick={_handleClose}>
|
||||
<ArrowBackIcon />
|
||||
</Button>
|
||||
<div
|
||||
className={classes.image}
|
||||
style={{ backgroundImage: `url(${meta.image})` }}
|
||||
/>
|
||||
<div className={classes.actionDiv}>
|
||||
<Button onClick={handleDeletePhoto}>
|
||||
<DeleteIcon fontSize="large" />
|
||||
<DeleteIcon fontSize='large' />
|
||||
</Button>
|
||||
<Button onClick={handleSharePhoto}>
|
||||
<ShareIcon fontSize="large" />
|
||||
<ShareIcon fontSize='large' />
|
||||
</Button>
|
||||
</div>
|
||||
</Paper>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -2,9 +2,9 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
backgroundModal: {
|
||||
background: "black",
|
||||
opacity: "0.6",
|
||||
position: "absolute",
|
||||
background: 'black',
|
||||
opacity: '0.6',
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
@@ -17,7 +17,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
width: '100%',
|
||||
},
|
||||
modalHide: {
|
||||
display: 'none'
|
||||
display: 'none',
|
||||
},
|
||||
image: {
|
||||
width: 'auto',
|
||||
@@ -27,22 +27,22 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
backgroundPosition: 'center',
|
||||
backgroundSize: 'cover',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
marginTop: '4em'
|
||||
marginTop: '4em',
|
||||
},
|
||||
actionDiv: {
|
||||
marginTop: 15,
|
||||
display: 'flex',
|
||||
justifyContent: 'space-evenly'
|
||||
justifyContent: 'space-evenly',
|
||||
},
|
||||
|
||||
// share modal
|
||||
shareModal: {
|
||||
marginBottom: 50
|
||||
marginBottom: 50,
|
||||
},
|
||||
innerShareModal: {
|
||||
marginTop: 40,
|
||||
textAlign: 'center'
|
||||
}
|
||||
}))
|
||||
textAlign: 'center',
|
||||
},
|
||||
}));
|
||||
|
||||
export default useStyles;
|
||||
export default useStyles;
|
||||
@@ -3,22 +3,22 @@ import { atom } from 'recoil';
|
||||
export const photoState = {
|
||||
photos: atom({
|
||||
key: 'galleryPhotos',
|
||||
default: null
|
||||
default: null,
|
||||
}),
|
||||
modal: atom({
|
||||
key: 'photoModal',
|
||||
default: false
|
||||
default: false,
|
||||
}),
|
||||
photoMeta: atom({
|
||||
key: 'photoMeta',
|
||||
default: null
|
||||
default: null,
|
||||
}),
|
||||
shareModal: atom({
|
||||
key: 'phoneShareModal',
|
||||
default: false
|
||||
default: false,
|
||||
}),
|
||||
shareLink: atom({
|
||||
key: 'photoShareLink',
|
||||
default: null
|
||||
})
|
||||
}
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
@@ -3,5 +3,5 @@ import { photoState } from './state';
|
||||
|
||||
export const usePhotoMeta = () => {
|
||||
const [meta, setMeta] = useRecoilState(photoState.photoMeta);
|
||||
return { meta, setMeta};
|
||||
}
|
||||
return { meta, setMeta };
|
||||
};
|
||||
@@ -3,5 +3,5 @@ import { photoState } from './state';
|
||||
|
||||
export const usePhotoModal = () => {
|
||||
const [modal, setModal] = useRecoilState(photoState.modal);
|
||||
return { modal, setModal}
|
||||
}
|
||||
return { modal, setModal };
|
||||
};
|
||||
@@ -7,4 +7,4 @@ export const usePhotoService = () => {
|
||||
const setPhotos = useSetRecoilState(photoState.photos);
|
||||
useNuiEvent('CAMERA', 'setPhotos', setPhotos);
|
||||
return usePhotos();
|
||||
}
|
||||
};
|
||||
@@ -7,8 +7,7 @@ interface IPhotos {
|
||||
map?: any;
|
||||
}
|
||||
|
||||
|
||||
export const usePhotos = (): IPhotos | null => {
|
||||
const photos = useRecoilValue<IPhotos | null>(photoState.photos);
|
||||
return photos;
|
||||
}
|
||||
};
|
||||
@@ -2,6 +2,6 @@ import { useRecoilState } from 'recoil';
|
||||
import { photoState } from './state';
|
||||
|
||||
export const useShareLink = () => {
|
||||
const [ shareLink, setShareLink ] = useRecoilState(photoState.shareLink);
|
||||
return { shareLink, setShareLink }
|
||||
}
|
||||
const [shareLink, setShareLink] = useRecoilState(photoState.shareLink);
|
||||
return { shareLink, setShareLink };
|
||||
};
|
||||
@@ -2,6 +2,6 @@ import { useRecoilState } from 'recoil';
|
||||
import { photoState } from './state';
|
||||
|
||||
export const useShareModal = () => {
|
||||
const [ shareModal, setShareModal ] = useRecoilState(photoState.shareModal);
|
||||
return { shareModal, setShareModal }
|
||||
}
|
||||
const [shareModal, setShareModal] = useRecoilState(photoState.shareModal);
|
||||
return { shareModal, setShareModal };
|
||||
};
|
||||
Reference in new issue
Block a user