Merge pull request #64 from ente-io/responsive-ui

Responsive UI
This commit is contained in:
Abhinav-grd 2021-05-08 12:55:10 +05:30 committed by GitHub
commit d31525060e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 103 additions and 105 deletions

View file

@ -39,10 +39,7 @@ export default function MessageDialog({
centered centered
backdrop={attributes.staticBackdrop ? 'static' : 'true'} backdrop={attributes.staticBackdrop ? 'static' : 'true'}
> >
<Modal.Header <Modal.Header style={{ borderBottom: 'none' }} closeButton>
style={{ borderBottom: 'none' }}
closeButton={attributes.close != null}
>
{attributes.title && ( {attributes.title && (
<Modal.Title> <Modal.Title>
<strong>{attributes.title}</strong> <strong>{attributes.title}</strong>
@ -55,6 +52,12 @@ export default function MessageDialog({
</Modal.Body> </Modal.Body>
)} )}
<Modal.Footer style={{ borderTop: 'none' }}> <Modal.Footer style={{ borderTop: 'none' }}>
<div
style={{
display: 'flex',
flexWrap: 'wrap',
}}
>
{attributes.close && ( {attributes.close && (
<Button <Button
variant={`outline-${ variant={`outline-${
@ -63,7 +66,10 @@ export default function MessageDialog({
onClick={props.onHide} onClick={props.onHide}
style={{ style={{
padding: '6px 3em', padding: '6px 3em',
marginRight: '20px', margin: '0 20px',
marginBottom: '20px',
flex: 1,
whiteSpace: 'nowrap',
}} }}
> >
{attributes.close?.text ?? constants.OK} {attributes.close?.text ?? constants.OK}
@ -78,12 +84,19 @@ export default function MessageDialog({
attributes.proceed.action(); attributes.proceed.action();
props.onHide(); props.onHide();
}} }}
style={{ padding: '6px 3em', marginRight: '20px' }} style={{
padding: '6px 3em',
margin: '0 20px',
marginBottom: '20px',
flex: 1,
whiteSpace: 'nowrap',
}}
disabled={attributes.proceed.disabled} disabled={attributes.proceed.disabled}
> >
{attributes.proceed.text} {attributes.proceed.text}
</Button> </Button>
)} )}
</div>
</Modal.Footer> </Modal.Footer>
</Modal> </Modal>
); );

View file

@ -90,17 +90,14 @@ const GlobalStyles = createGlobalStyle`
.pswp__img { .pswp__img {
object-fit: contain; object-fit: contain;
} }
.modal-90w{
width:90vw;
max-width:960px!important;
}
.modal { .modal {
z-index: 2000; z-index: 2000;
} }
.modal-dialog-centered { .modal-dialog-centered {
min-height: -webkit-calc(90% - 3.5rem); min-height: -webkit-calc(80% - 3.5rem);
min-height: -moz-calc(90% - 3.5rem); min-height: -moz-calc(80% - 3.5rem);
min-height: calc(90% - 3.5rem); min-height: calc(80% - 3.5rem);
} }
.modal .modal-header, .modal .modal-footer { .modal .modal-header, .modal .modal-footer {
border-color: #444 !important; border-color: #444 !important;
@ -126,6 +123,11 @@ const GlobalStyles = createGlobalStyle`
background-color:#202020 !important; background-color:#202020 !important;
color:#aaa; color:#aaa;
} }
.modal-dialog{
max-width:960px!important;
width:90%;
margin:5% auto;
}
.download-btn{ .download-btn{
margin-top:10px; margin-top:10px;
width: 25px; width: 25px;
@ -176,10 +178,6 @@ const GlobalStyles = createGlobalStyle`
.alert-primary { .alert-primary {
background-color: #c4ffd6; background-color: #c4ffd6;
} }
.ente-modal{
width: 500px;
max-width:100%;
}
.bm-burger-button { .bm-burger-button {
position: fixed; position: fixed;
width: 24px; width: 24px;

View file

@ -1,3 +1,4 @@
import MessageDialog from 'components/MessageDialog';
import React from 'react'; import React from 'react';
import { Button, Modal } from 'react-bootstrap'; import { Button, Modal } from 'react-bootstrap';
import constants from 'utils/strings/constants'; import constants from 'utils/strings/constants';
@ -15,31 +16,15 @@ function ChoiceModal({
...props ...props
}: Props) { }: Props) {
return ( return (
<Modal <MessageDialog
{...props} {...props}
size="lg" attributes={{ title: constants.MULTI_FOLDER_UPLOAD }}
aria-labelledby="contained-modal-title-vcenter"
centered
> >
<Modal.Body style={{ padding: '24px' }}> <p>{constants.UPLOAD_STRATEGY_CHOICE}</p>
<Modal.Header
style={{
borderColor: 'rgb(16, 176, 2)',
fontSize: '20px',
marginBottom: '20px',
border: 'none',
}}
id="contained-modal-title-vcenter"
closeButton
>
{constants.UPLOAD_STRATEGY_CHOICE}
</Modal.Header>
<div <div
style={{ style={{
display: 'flex', display: 'flex',
justifyContent: 'space-around', flexWrap: 'wrap',
paddingBottom: '20px',
alignItems: 'center',
}} }}
> >
<Button <Button
@ -49,30 +34,38 @@ function ChoiceModal({
showCollectionCreateModal(); showCollectionCreateModal();
}} }}
style={{ style={{
padding: '12px', padding: '12px 24px',
paddingLeft: '24px', flex: 2,
paddingRight: '24px', whiteSpace: 'nowrap',
}} }}
> >
{constants.UPLOAD_STRATEGY_SINGLE_COLLECTION} {constants.UPLOAD_STRATEGY_SINGLE_COLLECTION}
</Button> </Button>
<div
style={{
flex: 1,
textAlign: 'center',
minWidth: '100px',
margin: '2% auto',
}}
>
<strong>{constants.OR}</strong> <strong>{constants.OR}</strong>
</div>
<Button <Button
variant="outline-success" variant="outline-success"
onClick={() => onClick={() =>
uploadFiles(UPLOAD_STRATEGY.COLLECTION_PER_FOLDER) uploadFiles(UPLOAD_STRATEGY.COLLECTION_PER_FOLDER)
} }
style={{ style={{
padding: '12px', padding: '12px 24px',
paddingLeft: '24px', flex: 2,
paddingRight: '24px', whiteSpace: 'nowrap',
}} }}
> >
{constants.UPLOAD_STRATEGY_COLLECTION_PER_FOLDER} {constants.UPLOAD_STRATEGY_COLLECTION_PER_FOLDER}
</Button> </Button>
</div> </div>
</Modal.Body> </MessageDialog>
</Modal>
); );
} }
export default ChoiceModal; export default ChoiceModal;

View file

@ -71,18 +71,14 @@ function CollectionSelector({
); );
return ( return (
<Modal <Modal {...props} size="xl" centered>
{...props}
dialogClassName="modal-90w"
style={{ maxWidth: '100%' }}
>
<Modal.Header closeButton> <Modal.Header closeButton>
<Modal.Title>{attributes.title}</Modal.Title> <Modal.Title>{attributes.title}</Modal.Title>
</Modal.Header> </Modal.Header>
<Modal.Body <Modal.Body
style={{ style={{
display: 'flex', display: 'flex',
justifyContent: 'flex-start', justifyContent: 'space-around',
flexWrap: 'wrap', flexWrap: 'wrap',
}} }}
> >

View file

@ -57,7 +57,7 @@ function PlanSelector(props: Props) {
); );
}; };
useEffect(() => { useEffect(() => {
if (!plans) { if (!plans && props.modalView) {
const main = async () => { const main = async () => {
props.setLoading(true); props.setLoading(true);
await billingService.updatePlans(); await billingService.updatePlans();
@ -65,7 +65,7 @@ function PlanSelector(props: Props) {
}; };
main(); main();
} }
}); }, [props.modalView]);
async function onPlanSelect(plan: Plan) { async function onPlanSelect(plan: Plan) {
if ( if (
@ -157,7 +157,7 @@ function PlanSelector(props: Props) {
<Modal <Modal
show={props.modalView} show={props.modalView}
onHide={props.closeModal} onHide={props.closeModal}
dialogClassName="modal-90w" size="xl"
centered centered
backdrop={hasPaidSubscription(subscription) ? 'true' : `static`} backdrop={hasPaidSubscription(subscription) ? 'true' : `static`}
> >
@ -207,8 +207,7 @@ function PlanSelector(props: Props) {
justifyContent: 'space-around', justifyContent: 'space-around',
flexWrap: 'wrap', flexWrap: 'wrap',
minHeight: '212px', minHeight: '212px',
marginTop: '24px', margin: '24px 0',
marginBottom: '36px',
}} }}
> >
{plans && PlanIcons} {plans && PlanIcons}

View file

@ -29,13 +29,11 @@ export default function UploadProgress(props: Props) {
? () => null ? () => null
: props.closeModal : props.closeModal
} }
size="lg"
aria-labelledby="contained-modal-title-vcenter" aria-labelledby="contained-modal-title-vcenter"
centered centered
backdrop={ backdrop={
props.uploadStage !== UPLOAD_STAGES.FINISH ? 'static' : 'true' props.uploadStage !== UPLOAD_STAGES.FINISH ? 'static' : 'true'
} }
dialogClassName="ente-modal"
> >
<Modal.Body> <Modal.Body>
<div <div

View file

@ -110,6 +110,7 @@ const englishConstants = {
DELETE_FILE_MESSAGE: 'sure you want to delete selected files?', DELETE_FILE_MESSAGE: 'sure you want to delete selected files?',
DELETE_FILE: 'delete files', DELETE_FILE: 'delete files',
DELETE: 'delete', DELETE: 'delete',
MULTI_FOLDER_UPLOAD: 'choose upload strategy',
UPLOAD_STRATEGY_CHOICE: UPLOAD_STRATEGY_CHOICE:
'you are uploading multiple folders, would you like us to create', 'you are uploading multiple folders, would you like us to create',
UPLOAD_STRATEGY_SINGLE_COLLECTION: 'a single album for everything', UPLOAD_STRATEGY_SINGLE_COLLECTION: 'a single album for everything',