Skip to content

Commit

Permalink
Running prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Kmaschta committed Mar 17, 2019
1 parent b981270 commit 224e7ce
Show file tree
Hide file tree
Showing 42 changed files with 844 additions and 717 deletions.
3 changes: 2 additions & 1 deletion examples/data-generator/src/customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export default (db, { serializeDate }) =>
zipcode: has_ordered ? address.zipCode() : null,
city: has_ordered ? address.city() : null,
avatar: internet.avatar(),
birthday: serializeDate && birthday ? birthday.toISOString() : birthday,
birthday:
serializeDate && birthday ? birthday.toISOString() : birthday,
first_seen: serializeDate ? first_seen.toISOString() : first_seen,
last_seen: serializeDate ? last_seen.toISOString() : last_seen,
has_ordered: has_ordered,
Expand Down
21 changes: 17 additions & 4 deletions examples/demo/src/visitors/VisitorCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ const VisitorCreate = ({ classes, ...props }) => (
<Create {...props}>
<TabbedForm>
<FormTab label="resources.customers.tabs.identity">
<TextInput autoFocus source="first_name" formClassName={classes.first_name} />
<TextInput source="last_name" formClassName={classes.last_name} />
<TextInput
autoFocus
source="first_name"
formClassName={classes.first_name}
/>
<TextInput
source="last_name"
formClassName={classes.last_name}
/>
<TextInput
type="email"
source="email"
Expand All @@ -41,10 +48,16 @@ const VisitorCreate = ({ classes, ...props }) => (
formClassName={classes.email}
/>
<DateInput source="birthday" formClassName={classes.birthday} />
<PasswordInput source="password" formClassName={classes.password} />
<PasswordInput
source="password"
formClassName={classes.password}
/>
</FormTab>
<FormTab label="resources.customers.tabs.address" path="address">
<LongTextInput source="address" formClassName={classes.address} />
<LongTextInput
source="address"
formClassName={classes.address}
/>
<TextInput source="zipcode" formClassName={classes.zipcode} />
<TextInput source="city" formClassName={classes.city} />
</FormTab>
Expand Down
38 changes: 30 additions & 8 deletions examples/demo/src/visitors/VisitorEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ import FullNameField from './FullNameField';
import SegmentsInput from './SegmentsInput';
import { styles } from './VisitorCreate';

const VisitorTitle = ({ record }) => (record ? <FullNameField record={record} size={32} /> : null);
const VisitorTitle = ({ record }) =>
record ? <FullNameField record={record} size={32} /> : null;

const VisitorEdit = ({ classes, ...props }) => (
<Edit title={<VisitorTitle />} {...props}>
<TabbedForm>
<FormTab label="resources.customers.tabs.identity">
<TextInput source="first_name" formClassName={classes.first_name} />
<TextInput source="last_name" formClassName={classes.last_name} />
<TextInput
source="first_name"
formClassName={classes.first_name}
/>
<TextInput
source="last_name"
formClassName={classes.last_name}
/>
<TextInput
type="email"
source="email"
Expand All @@ -40,10 +47,16 @@ const VisitorEdit = ({ classes, ...props }) => (
formClassName={classes.email}
/>
<DateInput source="birthday" formClassName={classes.birthday} />
<PasswordInput source="password" formClassName={classes.password} />
<PasswordInput
source="password"
formClassName={classes.password}
/>
</FormTab>
<FormTab label="resources.customers.tabs.address" path="address">
<LongTextInput source="address" formClassName={classes.address} />
<LongTextInput
source="address"
formClassName={classes.address}
/>
<TextInput source="zipcode" formClassName={classes.zipcode} />
<TextInput source="city" formClassName={classes.city} />
</FormTab>
Expand Down Expand Up @@ -78,20 +91,29 @@ const VisitorEdit = ({ classes, ...props }) => (
<DateField source="date" />
<ProductReferenceField />
<StarRatingField />
<TextField source="comment" cellClassName={classes.comment} />
<TextField
source="comment"
cellClassName={classes.comment}
/>
<EditButton style={{ padding: 0 }} />
</Datagrid>
</ReferenceManyField>
</FormTab>
<FormTab label="resources.customers.tabs.stats" path="stats">
<SegmentsInput />
<NullableBooleanInput source="has_newsletter" />
<DateField source="first_seen" style={{ width: 128, display: 'inline-block' }} />
<DateField
source="first_seen"
style={{ width: 128, display: 'inline-block' }}
/>
<DateField
source="latest_purchase"
style={{ width: 128, display: 'inline-block' }}
/>
<DateField source="last_seen" style={{ width: 128, display: 'inline-block' }} />
<DateField
source="last_seen"
style={{ width: 128, display: 'inline-block' }}
/>
</FormTab>
</TabbedForm>
</Edit>
Expand Down
13 changes: 7 additions & 6 deletions packages/ra-ui-materialui/src/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import classNames from 'classnames';
import { Link as RRLink } from 'react-router-dom';
import { withStyles, createStyles } from '@material-ui/core/styles';

const styles = theme => createStyles({
link: {
textDecoration: 'none',
color: theme.palette.primary.main,
},
});
const styles = theme =>
createStyles({
link: {
textDecoration: 'none',
color: theme.palette.primary.main,
},
});
/**
* @deprecated Use react-router-dom's Link instead
*/
Expand Down
49 changes: 25 additions & 24 deletions packages/ra-ui-materialui/src/auth/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,31 @@ import defaultTheme from '../defaultTheme';
import Notification from '../layout/Notification';
import DefaultLoginForm from './LoginForm';

const styles = theme => createStyles({
main: {
display: 'flex',
flexDirection: 'column',
minHeight: '100vh',
height: '1px',
alignItems: 'center',
justifyContent: 'flex-start',
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
},
card: {
minWidth: 300,
marginTop: '6em',
},
avatar: {
margin: '1em',
display: 'flex',
justifyContent: 'center',
},
icon: {
backgroundColor: theme.palette.secondary[500],
},
});
const styles = theme =>
createStyles({
main: {
display: 'flex',
flexDirection: 'column',
minHeight: '100vh',
height: '1px',
alignItems: 'center',
justifyContent: 'flex-start',
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
},
card: {
minWidth: 300,
marginTop: '6em',
},
avatar: {
margin: '1em',
display: 'flex',
justifyContent: 'center',
},
icon: {
backgroundColor: theme.palette.secondary[500],
},
});

const sanitizeRestProps = ({
array,
Expand Down
23 changes: 12 additions & 11 deletions packages/ra-ui-materialui/src/auth/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ import CircularProgress from '@material-ui/core/CircularProgress';
import { withStyles, createStyles } from '@material-ui/core/styles';
import { translate, userLogin } from 'ra-core';

const styles = () => createStyles({
form: {
padding: '0 1em 1em 1em',
},
input: {
marginTop: '1em',
},
button: {
width: '100%',
},
});
const styles = () =>
createStyles({
form: {
padding: '0 1em 1em 1em',
},
input: {
marginTop: '1em',
},
button: {
width: '100%',
},
});

// see http://redux-form.com/6.4.3/examples/material-ui/
const renderInput = ({
Expand Down
23 changes: 12 additions & 11 deletions packages/ra-ui-materialui/src/auth/Logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ import ExitIcon from '@material-ui/icons/PowerSettingsNew';
import classnames from 'classnames';
import { translate, userLogout as userLogoutAction } from 'ra-core';

const styles = theme => createStyles({
menuItem: {
color: theme.palette.text.secondary,
},
iconMenuPaddingStyle: {
paddingRight: '1.2em',
},
iconPaddingStyle: {
paddingRight: theme.spacing.unit,
},
});
const styles = theme =>
createStyles({
menuItem: {
color: theme.palette.text.secondary,
},
iconMenuPaddingStyle: {
paddingRight: '1.2em',
},
iconPaddingStyle: {
paddingRight: theme.spacing.unit,
},
});

const sanitizeRestProps = ({
classes,
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-ui-materialui/src/button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ Button.propTypes = {

Button.defaultProps = {
color: 'primary',
size: 'small'
}
size: 'small',
};

const enhance = compose(
withStyles(styles),
Expand Down
39 changes: 21 additions & 18 deletions packages/ra-ui-materialui/src/detail/TabbedShowLayout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import React, { Component, Children, cloneElement, isValidElement } from 'react';
import React, {
Component,
Children,
cloneElement,
isValidElement,
} from 'react';
import PropTypes from 'prop-types';
import Divider from '@material-ui/core/Divider';
import { withRouter, Route } from 'react-router-dom';
Expand Down Expand Up @@ -101,23 +106,21 @@ export class TabbedShowLayout extends Component {
)}
<Divider />
<CardContentInner>
{Children.map(
children,
(tab, index) =>
tab && isValidElement(tab) ? (
<Route
exact
path={getTabFullPath(tab, index, match.url)}
render={() =>
cloneElement(tab, {
context: 'content',
resource,
record,
basePath,
})
}
/>
) : null
{Children.map(children, (tab, index) =>
tab && isValidElement(tab) ? (
<Route
exact
path={getTabFullPath(tab, index, match.url)}
render={() =>
cloneElement(tab, {
context: 'content',
resource,
record,
basePath,
})
}
/>
) : null
)}
</CardContentInner>
</div>
Expand Down
11 changes: 6 additions & 5 deletions packages/ra-ui-materialui/src/field/ReferenceField.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import LinearProgress from '../layout/LinearProgress';
import Link from '../Link';
import sanitizeRestProps from './sanitizeRestProps';

const styles = theme => createStyles({
link: {
color: theme.palette.primary.main,
},
});
const styles = theme =>
createStyles({
link: {
color: theme.palette.primary.main,
},
});

// useful to prevent click bubbling in a datagrid with rowClick
const stopPropagation = e => e.stopPropagation();
Expand Down
7 changes: 4 additions & 3 deletions packages/ra-ui-materialui/src/form/FormInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import Labeled from '../input/Labeled';

const sanitizeRestProps = ({ basePath, record, ...rest }) => rest;

const styles = theme => createStyles({
input: { width: theme.spacing.unit * 32 },
});
const styles = theme =>
createStyles({
input: { width: theme.spacing.unit * 32 },
});

export const FormInput = ({ classes, input, ...rest }) =>
input ? (
Expand Down
Loading

0 comments on commit 224e7ce

Please sign in to comment.