Skip to content

Commit

Permalink
quick fix for the material-ui dialog bug not passing context to children
Browse files Browse the repository at this point in the history
  • Loading branch information
siyoola committed Apr 14, 2020
1 parent 345eb54 commit ea591f6
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 80 deletions.
2 changes: 1 addition & 1 deletion src/modules/customerGroups/head/components/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FontIcon from 'material-ui/FontIcon';
import IconMenu from 'material-ui/IconMenu';
import IconButton from 'material-ui/IconButton';
import MenuItem from 'material-ui/MenuItem';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
const { Fragment } = React;
Expand Down
14 changes: 8 additions & 6 deletions src/modules/customers/edit/components/addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import IconButton from 'material-ui/IconButton';
import FontIcon from 'material-ui/FontIcon';
import IconMenu from 'material-ui/IconMenu';
import MenuItem from 'material-ui/MenuItem';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import AddressForm from './addressForm.js';
import style from './style.css';

Expand Down Expand Up @@ -136,11 +136,13 @@ class CustomerAddress extends React.Component {
autoScrollBodyContent
contentStyle={{ width: 600 }}
>
<AddressForm
initialValues={address}
onCancel={this.hideEditForm}
onSubmit={this.handleEditForm}
/>
<div style={{width:"500px", margin:"25px"}} >
<AddressForm
initialValues={address}
onCancel={this.hideEditForm}
onSubmit={this.handleEditForm}
/>
</div>
</Dialog>
</div>
</Paper>
Expand Down
14 changes: 8 additions & 6 deletions src/modules/customers/edit/components/summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import FontIcon from 'material-ui/FontIcon';
import IconMenu from 'material-ui/IconMenu';
import MenuItem from 'material-ui/MenuItem';
import SelectField from 'material-ui/SelectField';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import SummaryForm from './summaryForm.js';
import style from './style.css';

Expand Down Expand Up @@ -103,11 +103,13 @@ export default class CustomerSummary extends React.Component {
onRequestClose={this.hideSummaryEdit}
contentStyle={{ width: 600 }}
>
<SummaryForm
initialValues={customer}
onCancel={this.hideSummaryEdit}
onSubmit={this.saveSummaryEdit}
/>
<div style={{width:"500px", margin:"25px"}} >
<SummaryForm
initialValues={customer}
onCancel={this.hideSummaryEdit}
onSubmit={this.saveSummaryEdit}
/>
</div>
</Dialog>
</div>
</Paper>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/customers/listHead/components/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import FontIcon from 'material-ui/FontIcon';
import IconMenu from 'material-ui/IconMenu';
import IconButton from 'material-ui/IconButton';
import MenuItem from 'material-ui/MenuItem';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import TextField from 'material-ui/TextField';
Expand Down
16 changes: 9 additions & 7 deletions src/modules/orders/edit/components/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Paper from 'material-ui/Paper';
import Divider from 'material-ui/Divider';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import ShippingAddressForm from './shippingAddressForm.js';
import style from './style.css';

Expand Down Expand Up @@ -226,12 +226,14 @@ export default class OrderCustomer extends React.Component {
autoScrollBodyContent
contentStyle={{ width: 600 }}
>
<ShippingAddressForm
initialValues={order.shipping_address}
onCancel={this.hideShippingEdit}
onSubmit={this.saveShippingEdit}
shippingMethod={order.shipping_method_details}
/>
<div style={{width:"500px", margin:"25px"}} >
<ShippingAddressForm
initialValues={order.shipping_address}
onCancel={this.hideShippingEdit}
onSubmit={this.saveShippingEdit}
shippingMethod={order.shipping_method_details}
/>
</div>
</Dialog>
</div>
</Paper>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/orders/edit/components/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import FontIcon from 'material-ui/FontIcon';
import IconMenu from 'material-ui/IconMenu';
import MenuItem from 'material-ui/MenuItem';
import SelectField from 'material-ui/SelectField';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import style from './style.css';

const iconButtonElement = (
Expand Down Expand Up @@ -272,7 +272,7 @@ export class OrderItem extends React.Component {
onRequestClose={this.hideEditForm}
contentStyle={{ width: 400 }}
>
<div>
<div style={{width:"400px", margin:"25px"}} >
<ProductOptions
options={productOptions}
onChange={this.onOptionChange}
Expand Down
15 changes: 9 additions & 6 deletions src/modules/orders/edit/components/summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as helper from 'lib/helper';

import Paper from 'material-ui/Paper';
import RaisedButton from 'material-ui/RaisedButton';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import SummaryForm from './summaryForm.js';
import style from './style.css';

Expand Down Expand Up @@ -204,13 +204,16 @@ export default class OrderSummary extends React.Component {
open={this.state.openSummaryEdit}
onRequestClose={this.hideSummaryEdit}
autoScrollBodyContent
maxWidth="md"
contentStyle={{ width: 600 }}
>
<SummaryForm
initialValues={order}
onCancel={this.hideSummaryEdit}
onSubmit={this.saveSummaryEdit}
/>
<div style={{width:"500px", margin:"25px"}} >
<SummaryForm
initialValues={order}
onCancel={this.hideSummaryEdit}
onSubmit={this.saveSummaryEdit}
/>
</div>
</Dialog>
</div>
</Paper>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/productCategories/head/components/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FontIcon from 'material-ui/FontIcon';
import IconMenu from 'material-ui/IconMenu';
import IconButton from 'material-ui/IconButton';
import MenuItem from 'material-ui/MenuItem';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
const { Fragment } = React;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Field, FieldArray, reduxForm } from 'redux-form';
import messages from 'lib/text';
import CategoryMultiselect from 'modules/productCategories/components/multiselectList';
import FontIcon from 'material-ui/FontIcon';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import style from './style.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Field, FieldArray, reduxForm } from 'redux-form';
import messages from 'lib/text';
import CategorySelect from 'modules/productCategories/select';
import FontIcon from 'material-ui/FontIcon';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import style from './style.css';
Expand Down
16 changes: 9 additions & 7 deletions src/modules/products/edit/images/components/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import messages from 'lib/text';
import Gallery from 'modules/shared/imageUploadMultiple';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';

export default class ProductImages extends React.Component {
Expand Down Expand Up @@ -87,12 +87,14 @@ export default class ProductImages extends React.Component {
onRequestClose={this.closeEdit}
autoScrollBodyContent={false}
>
<TextField
floatingLabelText={messages.alt}
fullWidth
value={alt}
onChange={this.handleAltChange}
/>
<div style={{width:"500px", margin:"25px"}} >
<TextField
floatingLabelText={messages.alt}
fullWidth
value={alt}
onChange={this.handleAltChange}
/>
</div>
</Dialog>
</div>
</Paper>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/products/listHead/components/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import DeleteConfirmation from 'modules/shared/deleteConfirmation';
import FontIcon from 'material-ui/FontIcon';
import IconMenu from 'material-ui/IconMenu';
import IconButton from 'material-ui/IconButton';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';
import Search from './search';
const { Fragment } = React;
Expand Down
44 changes: 23 additions & 21 deletions src/modules/settings/paymentGateway/components/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { reduxForm } from 'redux-form';

import messages from 'lib/text';

import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import style from './style.css';
Expand Down Expand Up @@ -59,27 +59,29 @@ class EditPaymentGatewayForm extends React.Component {
contentStyle={{ width: 600 }}
onRequestClose={this.handleClose}
>
<form
onSubmit={handleSubmit}
style={{ display: 'initial', width: '100%' }}
>
<GatewaySettings gateway={this.props.gateway} />
<div style={{width:"500px", margin:"25px"}} >
<form
onSubmit={handleSubmit}
style={{ display: 'initial', width: '100%' }}
>
<GatewaySettings gateway={this.props.gateway} />

<div className={style.buttons}>
<FlatButton
label={messages.cancel}
onClick={this.handleClose}
/>
<FlatButton
label={messages.save}
primary
type="submit"
onClick={this.handleClose}
style={{ marginLeft: 12 }}
disabled={pristine || submitting}
/>
</div>
</form>
<div className={style.buttons}>
<FlatButton
label={messages.cancel}
onClick={this.handleClose}
/>
<FlatButton
label={messages.save}
primary
type="submit"
onClick={this.handleClose}
style={{ marginLeft: 12 }}
disabled={pristine || submitting}
/>
</div>
</form>
</div>
</Dialog>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/shared/confirmation/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';

export default class ConfirmationDialog extends React.Component {
Expand Down
34 changes: 17 additions & 17 deletions src/modules/shared/deleteConfirmation/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import messages from 'lib/text';
import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import FlatButton from 'material-ui/FlatButton';

export default class ConfirmationDialog extends React.Component {
Expand Down Expand Up @@ -48,31 +49,30 @@ export default class ConfirmationDialog extends React.Component {
? messages.singleDeleteDescription
: messages.multipleDeleteDescription.replace('{count}', itemsCount);

const actions = [
<FlatButton
label={messages.cancel}
onClick={this.handleCancel}
style={{ marginRight: 10 }}
/>,
<FlatButton
label={messages.actions_delete}
primary
keyboardFocused
onClick={this.handleDelete}
/>
];

return (
<Dialog
title={title}
actions={actions}
modal={false}
open={this.state.open}
onRequestClose={this.handleCancel}
contentStyle={{ maxWidth: 540 }}
titleStyle={{ fontSize: '18px', lineHeight: '28px' }}
>
<div style={{ wordWrap: 'break-word' }}>{description}</div>
<div style={{ wordWrap: 'break-word', width:"500px", margin:"25px" }}>{description}</div>
<DialogActions>
<FlatButton
label={messages.cancel}
onClick={this.handleCancel}
style={{ marginRight: 10 }}
/>
<FlatButton
label={messages.actions_delete}
primary
keyboardFocused
onClick={this.handleDelete}
/>
</DialogActions>

</Dialog>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/shared/productSearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import messages from 'lib/text';
import api from 'lib/api';
import * as helper from 'lib/helper';

import Dialog from 'material-ui/Dialog';
import Dialog from '@material-ui/core/Dialog';
import FlatButton from 'material-ui/FlatButton';
import TextField from 'material-ui/TextField';
import {
Expand Down

0 comments on commit ea591f6

Please sign in to comment.