fix(settings): Fix layout issues that caused horizontal scrolling
Closes #17931
This commit is contained in:
committed by
mrugesh mohapatra
parent
ec444f71ad
commit
5cfa1cd78c
@ -4,7 +4,6 @@ import { connect } from 'react-redux';
|
|||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { Button } from 'react-bootstrap';
|
import { Button } from 'react-bootstrap';
|
||||||
|
|
||||||
import ns from './ns.json';
|
|
||||||
import { FullWidthRow, Spacer, Loader } from '../../helperComponents';
|
import { FullWidthRow, Spacer, Loader } from '../../helperComponents';
|
||||||
import AboutSettings from './components/About-Settings.jsx';
|
import AboutSettings from './components/About-Settings.jsx';
|
||||||
import InternetSettings from './components/Internet-Settings.jsx';
|
import InternetSettings from './components/Internet-Settings.jsx';
|
||||||
@ -53,7 +52,6 @@ const propTypes = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export class Settings extends React.Component {
|
export class Settings extends React.Component {
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
this.props.updateTitle('Settings');
|
this.props.updateTitle('Settings');
|
||||||
}
|
}
|
||||||
@ -73,7 +71,7 @@ export class Settings extends React.Component {
|
|||||||
return <Loader />;
|
return <Loader />;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className={ `${ns}-container` }>
|
<div>
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
<Button
|
<Button
|
||||||
block={ true }
|
block={ true }
|
||||||
@ -95,7 +93,6 @@ export class Settings extends React.Component {
|
|||||||
</Button>
|
</Button>
|
||||||
</FullWidthRow>
|
</FullWidthRow>
|
||||||
<h1 className='text-center'>{ `Account Settings for ${username}` }</h1>
|
<h1 className='text-center'>{ `Account Settings for ${username}` }</h1>
|
||||||
<div className='offset-negative-row'>
|
|
||||||
<AboutSettings />
|
<AboutSettings />
|
||||||
<Spacer />
|
<Spacer />
|
||||||
<PrivacySettings />
|
<PrivacySettings />
|
||||||
@ -111,7 +108,6 @@ export class Settings extends React.Component {
|
|||||||
<CertificationSettings />
|
<CertificationSettings />
|
||||||
<Spacer />
|
<Spacer />
|
||||||
<DangerZone />
|
<DangerZone />
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { Grid } from 'react-bootstrap';
|
||||||
|
|
||||||
import ns from './ns.json';
|
import ns from './ns.json';
|
||||||
import { showUpdateEmailViewSelector } from './redux';
|
import { showUpdateEmailViewSelector } from './redux';
|
||||||
@ -11,28 +12,30 @@ import ChildContainer from '../../Child-Container.jsx';
|
|||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
showUpdateEmailView: showUpdateEmailViewSelector(state)
|
showUpdateEmailView: showUpdateEmailViewSelector(state)
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = null;
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
showUpdateEmailView: PropTypes.bool
|
showUpdateEmailView: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
export function ShowSettings({ showUpdateEmailView }) {
|
export function ShowSettings({ showUpdateEmailView }) {
|
||||||
let Comp = Settings;
|
let ChildComponent = Settings;
|
||||||
|
|
||||||
if (showUpdateEmailView) {
|
if (showUpdateEmailView) {
|
||||||
Comp = UpdateEmail;
|
ChildComponent = UpdateEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ChildContainer>
|
<ChildContainer>
|
||||||
<div className={ `${ns}-container` }>
|
<Grid className={ `${ns}-container` }>
|
||||||
<Comp />
|
<ChildComponent />
|
||||||
</div>
|
</Grid>
|
||||||
</ChildContainer>
|
</ChildContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowSettings.displayName = 'ShowSettings';
|
ShowSettings.displayName = 'ShowSettings';
|
||||||
ShowSettings.propTypes = propTypes;
|
ShowSettings.propTypes = propTypes;
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps
|
||||||
mapDispatchToProps
|
|
||||||
)(ShowSettings);
|
)(ShowSettings);
|
@ -1,6 +1,6 @@
|
|||||||
import { types } from './redux';
|
import { types } from './redux';
|
||||||
|
|
||||||
export { default } from './Show.jsx';
|
export { default } from './ShowSettings.jsx';
|
||||||
|
|
||||||
export const routes = {
|
export const routes = {
|
||||||
[types.onRouteSettings]: '/settings',
|
[types.onRouteSettings]: '/settings',
|
||||||
|
@ -27,26 +27,32 @@ const fields = [
|
|||||||
];
|
];
|
||||||
const validateFields = ({ email, duplicate }) => {
|
const validateFields = ({ email, duplicate }) => {
|
||||||
const errors = {};
|
const errors = {};
|
||||||
|
|
||||||
if (!isEmail('' + email)) {
|
if (!isEmail('' + email)) {
|
||||||
errors.email = 'This email is invalid.';
|
errors.email = 'This email is invalid.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duplicate && email !== duplicate) {
|
if (duplicate && email !== duplicate) {
|
||||||
errors.duplicate = 'This email does not match the one above.';
|
errors.duplicate = 'This email does not match the one above.';
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors;
|
return errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const {
|
const {
|
||||||
app: { user: username },
|
app: { user: username },
|
||||||
entities: { user: userMap }
|
entities: { user: userMap }
|
||||||
} = state;
|
} = state;
|
||||||
const { email, emailVerified } = userMap[username] || {};
|
const { email, emailVerified } = userMap[username] || {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
initialValues: { email },
|
initialValues: { email },
|
||||||
isEmailThere: !!email,
|
isEmailThere: !!email,
|
||||||
isVerified: !!emailVerified
|
isVerified: !!emailVerified
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
fields: PropTypes.object.isRequired,
|
fields: PropTypes.object.isRequired,
|
||||||
handleSubmit: PropTypes.func.isRequired,
|
handleSubmit: PropTypes.func.isRequired,
|
||||||
@ -61,6 +67,7 @@ export class UpdateEmail extends React.Component {
|
|||||||
super(...props);
|
super(...props);
|
||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.handleSubmit(({ email }) => this.props.updateMyEmail(email))(e);
|
this.props.handleSubmit(({ email }) => this.props.updateMyEmail(email))(e);
|
||||||
|
@ -28,11 +28,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.offset-negative-row{
|
|
||||||
margin-right: 15px;
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.@{ns}-container {
|
.@{ns}-container {
|
||||||
.center(@value: @container-xl, @padding: @grid-gutter-width);
|
.center(@value: @container-xl, @padding: @grid-gutter-width);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user