Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6dc0ac0
Showing
49 changed files
with
3,737 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.js] | ||
trim_trailing_whitespace = false | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended", | ||
//"airbnb", | ||
"plugin:meteor/recommended", | ||
"plugin:react/recommended" | ||
], | ||
"parser": "babel-eslint", | ||
"parserOptions": { | ||
"allowImportExportEverywhere": true, | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"babel/generator-star-spacing": 0, | ||
"babel/new-cap": [1, { | ||
"capIsNewExceptions": [ | ||
"Optional", | ||
"OneOf", | ||
"Maybe", | ||
"MailChimpAPI", | ||
"Juice", | ||
"Run", | ||
"AppComposer", | ||
"Query", | ||
"InArray" | ||
] | ||
}], | ||
"babel/array-bracket-spacing": 0, | ||
"babel/object-curly-spacing": 0, | ||
"babel/object-shorthand": 0, | ||
"babel/arrow-parens": 0, | ||
"babel/no-await-in-loop": 1, | ||
"comma-dangle": 0, | ||
"key-spacing": 0, | ||
"no-extra-boolean-cast": 0, | ||
"no-undef": 1, | ||
"no-unused-vars": [1, { | ||
"vars": "all", | ||
"args": "none", | ||
"varsIgnorePattern": "React|PropTypes|Component" | ||
}], | ||
"react/prop-types": 0, | ||
"meteor/audit-argument-checks": 0, | ||
"meteor/no-session": 0, | ||
"no-case-declarations": 0, | ||
"no-console": 0, | ||
"semi": "error" | ||
}, | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"meteor": true, | ||
"node": true | ||
}, | ||
"plugins": [ | ||
"babel", | ||
"meteor", | ||
"react", | ||
"jsx-a11y" | ||
], | ||
"settings": { | ||
"import/resolver": { | ||
"meteor": { | ||
"paths": [ | ||
"/usr/local/share/global_modules" | ||
], | ||
"moduleDirectory": [ | ||
"node_modules", | ||
"packages" | ||
] | ||
} | ||
} | ||
}, | ||
"root": true, | ||
"globals": { | ||
"param": true, | ||
"returns": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Button from 'material-ui/Button'; | ||
import { replaceComponent, Utils } from 'meteor/vulcan:core'; | ||
import classNames from 'classnames'; | ||
|
||
|
||
export class AccountsButton extends PureComponent { | ||
render () { | ||
|
||
const { | ||
label, | ||
href = null, | ||
type, | ||
disabled = false, | ||
className, | ||
onClick | ||
} = this.props; | ||
|
||
return ( | ||
<Button | ||
raised={type !== 'link'} | ||
dense={type === 'link'} | ||
color="primary" | ||
className={classNames(`button-${Utils.slugify(label)}`, className)} | ||
type={type} | ||
disabled={disabled} | ||
onClick={onClick}> | ||
{label} | ||
</Button> | ||
); | ||
} | ||
} | ||
|
||
|
||
AccountsButton.propTypes = { | ||
onClick: PropTypes.func, | ||
}; | ||
|
||
|
||
replaceComponent('AccountsButton', AccountsButton); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Components, replaceComponent } from 'meteor/vulcan:core'; | ||
import { CardActions } from 'material-ui/Card'; | ||
import { withStyles } from 'material-ui/styles'; | ||
import classNames from 'classnames'; | ||
|
||
|
||
const styles = theme => ({ | ||
root: { | ||
flexDirection: 'row-reverse', | ||
padding: theme.spacing.unit * 2, | ||
height: 'auto', | ||
}, | ||
}); | ||
|
||
|
||
export class Buttons extends React.Component { | ||
render () { | ||
|
||
const { | ||
classes, | ||
buttons = {}, | ||
className = null, | ||
} = this.props; | ||
|
||
return ( | ||
<CardActions className={classNames(classes.root, className)}> | ||
{Object.keys(buttons).map((id, i) => | ||
<Components.AccountsButton {...buttons[id]} key={i}/> | ||
)} | ||
</CardActions> | ||
); | ||
} | ||
} | ||
|
||
|
||
Buttons.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
|
||
Buttons.displayName = 'AccountsButtons'; | ||
|
||
|
||
replaceComponent('AccountsButtons', Buttons, [withStyles, styles]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { replaceComponent } from 'meteor/vulcan:core'; | ||
import TextField from 'material-ui/TextField'; | ||
|
||
|
||
export class AccountsField extends PureComponent { | ||
|
||
|
||
constructor (props) { | ||
super(props); | ||
this.state = { | ||
mount: true | ||
}; | ||
} | ||
|
||
|
||
triggerUpdate () { | ||
// Trigger an onChange on initial load, to support browser pre-filled values. | ||
const { onChange } = this.props; | ||
if (this.input && onChange) { | ||
onChange({ target: { value: this.input.value } }); | ||
} | ||
} | ||
|
||
|
||
componentDidMount () { | ||
this.triggerUpdate(); | ||
} | ||
|
||
|
||
componentDidUpdate (prevProps) { | ||
// Re-mount component so that we don't expose browser pre-filled passwords if the component was | ||
// a password before and now something else. | ||
if (prevProps.id !== this.props.id) { | ||
this.setState({ mount: false }); | ||
} else if (!this.state.mount) { | ||
this.setState({ mount: true }); | ||
this.triggerUpdate(); | ||
} | ||
} | ||
|
||
|
||
render () { | ||
const { | ||
id, | ||
hint, | ||
label, | ||
type = 'text', | ||
onChange, | ||
required = false, | ||
className = 'field', | ||
defaultValue = '', | ||
autoFocus, | ||
message, | ||
} = this.props; | ||
const { mount = true } = this.state; | ||
|
||
if (type === 'notice') { | ||
return <div className={className}>{label}</div>; | ||
} | ||
|
||
return ( | ||
mount && | ||
|
||
<div className={className} style={{ marginBottom: '10px' }}> | ||
<TextField | ||
id={id} | ||
type={type} | ||
label={label} | ||
placeholder={hint} | ||
defaultValue={defaultValue} | ||
autoFocus={autoFocus} | ||
onChange={onChange} | ||
required={required} | ||
error={!!message} | ||
helperText={message && message.message} | ||
fullWidth | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
|
||
AccountsField.propTypes = { | ||
onChange: PropTypes.func, | ||
}; | ||
|
||
|
||
replaceComponent('AccountsField', AccountsField); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import { Components, replaceComponent } from 'meteor/vulcan:core'; | ||
import { CardContent } from 'material-ui/Card'; | ||
|
||
|
||
export class AccountsFields extends React.Component { | ||
render () { | ||
let { | ||
fields = {}, | ||
className = 'fields' | ||
} = this.props; | ||
|
||
return ( | ||
<CardContent className={className}> | ||
{Object.keys(fields).map((id, i) => | ||
<Components.AccountsField {...fields[id]} autoFocus={i === 0} key={i}/> | ||
)} | ||
</CardContent> | ||
); | ||
} | ||
} | ||
|
||
|
||
replaceComponent('AccountsFields', AccountsFields); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import { Components, registerComponent } from 'meteor/vulcan:core'; | ||
|
||
|
||
export class AccountsForm extends PureComponent { | ||
componentDidMount () { | ||
let form = this.form; | ||
if (form) { | ||
form.addEventListener('submit', (e) => { | ||
e.preventDefault(); | ||
}); | ||
} | ||
} | ||
|
||
render () { | ||
const { | ||
hasPasswordService, | ||
oauthServices, | ||
fields, | ||
buttons, | ||
error, | ||
messages, | ||
ready = true, | ||
className | ||
} = this.props; | ||
|
||
return ( | ||
<form | ||
ref={(ref) => this.form = ref} | ||
className={classNames(className, 'accounts-ui', { 'ready': ready, })} | ||
noValidate | ||
> | ||
<Components.AccountsFields fields={fields}/> | ||
<Components.AccountsButtons buttons={buttons}/> | ||
<Components.AccountsPasswordOrService oauthServices={oauthServices}/> | ||
<Components.AccountsSocialButtons oauthServices={oauthServices}/> | ||
<Components.AccountsFormMessages messages={messages}/> | ||
</form> | ||
); | ||
} | ||
} | ||
|
||
|
||
AccountsForm.propTypes = { | ||
oauthServices: PropTypes.object, | ||
fields: PropTypes.object.isRequired, | ||
buttons: PropTypes.object.isRequired, | ||
error: PropTypes.string, | ||
ready: PropTypes.bool | ||
}; | ||
|
||
|
||
registerComponent('AccountsForm', AccountsForm); |
Oops, something went wrong.