Skip to content

Commit 745f020

Browse files
author
Harshil Patel
committed
Boilerplate setup
1 parent 40ce5eb commit 745f020

File tree

131 files changed

+3912
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+3912
-0
lines changed

Diff for: .babelrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"presets": ["@babel/env", "@babel/react"],
3+
"plugins": [
4+
["ramda", { "useES": true }]
5+
],
6+
"env": {
7+
"test": {
8+
"plugins": ["ramda"]
9+
}
10+
}
11+
}

Diff for: .eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
coverage

Diff for: .gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Dependency Modules
2+
node_modules
3+
4+
# App Packaged
5+
dist
6+
build
7+
*.zip
8+
9+
# Test
10+
coverage
11+
12+
# Environment
13+
.env*
14+
15+
# NPM
16+
.npm
17+
package-lock.json
18+
yarn.lock
19+
20+
# Logs
21+
logs
22+
*.log
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# Patches
28+
patches
29+
30+
# OSX
31+
.DS_Store

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018-present Federico Rojas
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: client/.eslintrc.js

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['airbnb', 'airbnb/hooks'],
4+
parser: '@babel/eslint-parser',
5+
env: {
6+
browser: true,
7+
jest: true,
8+
},
9+
settings: {
10+
'import/resolver': {
11+
webpack: { config: './client/config/webpack.config.js' },
12+
},
13+
},
14+
rules: {
15+
// enable rules
16+
'react/jsx-key': 2,
17+
'object-curly-newline': [2, {
18+
ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
19+
ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
20+
}],
21+
'import/order': [2, {
22+
'pathGroups': [
23+
{ pattern: 'react', group: 'builtin', position: 'before' },
24+
{ pattern: '@mui/**', group: 'external', position: 'after' },
25+
{ pattern: '@fortawesome/**', group: 'external', position: 'after' },
26+
{ pattern: 'react-bulma-companion/**', group: 'external', position: 'after' },
27+
{ pattern: '_client/**', group: 'internal', position: 'after' },
28+
{ pattern: '_components/**', group: 'internal', position: 'after' },
29+
{ pattern: '_store/**', group: 'internal', position: 'after' },
30+
{ pattern: '_styles/**', group: 'internal', position: 'after' },
31+
{ pattern: '_hooks/**', group: 'internal', position: 'after' },
32+
{ pattern: '_utils/**', group: 'internal', position: 'after' },
33+
],
34+
'pathGroupsExcludedImportTypes': ['react'],
35+
'alphabetize': {
36+
order: 'asc',
37+
caseInsensitive: true,
38+
},
39+
'newlines-between': 'always',
40+
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
41+
}],
42+
'sort-imports': [2, {
43+
ignoreCase: true,
44+
ignoreDeclarationSort: true,
45+
ignoreMemberSort: false,
46+
allowSeparatedGroups: true,
47+
}],
48+
49+
// override defaults
50+
'eqeqeq': [2, 'smart'],
51+
'max-len': [2, { code: 120, tabWidth: 2, ignoreUrls: true }],
52+
'newline-per-chained-call': [2, { ignoreChainWithDepth: 4 }],
53+
'no-cond-assign': [2, 'except-parens'],
54+
'no-multi-spaces': [2, {
55+
exceptions: {
56+
ImportDeclaration: true,
57+
Property: true,
58+
VariableDeclarator: true,
59+
},
60+
}],
61+
'quote-props': [2, 'consistent-as-needed'],
62+
'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx'] }],
63+
'react/jsx-fragments': [2, 'element'],
64+
65+
// disable rules
66+
'arrow-parens': 0,
67+
'default-param-last': 0,
68+
'function-paren-newline': 0,
69+
'implicit-arrow-linebreak': 0,
70+
'import/no-cycle': 0,
71+
'import/no-extraneous-dependencies': 0,
72+
'import/no-named-as-default': 0,
73+
'import/prefer-default-export': 0,
74+
'jsx-a11y/anchor-is-valid': 0,
75+
'jsx-a11y/label-has-associated-control': 0,
76+
'jsx-a11y/label-has-for': 0,
77+
'jsx-a11y/no-static-element-interactions': 0,
78+
'no-confusing-arrow': 0,
79+
'no-nested-ternary': 0,
80+
'no-plusplus': 0,
81+
'no-shadow': 0,
82+
'no-underscore-dangle': 0,
83+
'react/destructuring-assignment': 0,
84+
'react/forbid-prop-types': 0,
85+
'react/jsx-boolean-value': 0,
86+
'react/jsx-props-no-spreading': 0,
87+
'react/state-in-constructor': 0,
88+
'react/static-property-placement': 0,
89+
},
90+
};

Diff for: client/api/auth.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import request from 'superagent';
2+
3+
import { handleError, handleSuccess } from '_utils/api';
4+
5+
export const postRegister = user =>
6+
request.post('/api/auth/register')
7+
.send(user)
8+
.then(handleSuccess)
9+
.catch(handleError);
10+
11+
export const postLogin = user =>
12+
request.post('/api/auth/login')
13+
.send(user)
14+
.then(handleSuccess)
15+
.catch(handleError);
16+
17+
export const postLogout = () =>
18+
request.post('/api/auth/logout')
19+
.then(handleSuccess)
20+
.catch(handleError);

Diff for: client/api/todos.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import request from 'superagent';
2+
3+
import { handleError, handleSuccess } from '_utils/api';
4+
5+
export const postTodo = info =>
6+
request.post('/api/todos')
7+
.send(info)
8+
.then(handleSuccess)
9+
.catch(handleError);
10+
11+
export const getTodos = () =>
12+
request.get('/api/todos')
13+
.then(handleSuccess)
14+
.catch(handleError);
15+
16+
export const putToggleCompleteTodo = info =>
17+
request.put('/api/todos/complete')
18+
.send(info)
19+
.then(handleSuccess)
20+
.catch(handleError);
21+
22+
export const putTodo = info =>
23+
request.put('/api/todos')
24+
.send(info)
25+
.then(handleSuccess)
26+
.catch(handleError);
27+
28+
export const deleteTodo = info =>
29+
request.delete('/api/todos')
30+
.send(info)
31+
.then(handleSuccess)
32+
.catch(handleError);

Diff for: client/api/user.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import request from 'superagent';
2+
3+
import { handleError, handleSuccess } from '_utils/api';
4+
5+
export const getUser = () =>
6+
request.get('/api/user')
7+
.then(handleSuccess)
8+
.catch(handleError);
9+
10+
export const putUser = info =>
11+
request.put('/api/user')
12+
.send(info)
13+
.then(handleSuccess)
14+
.catch(handleError);
15+
16+
export const putUserPassword = passwordInfo =>
17+
request.put('/api/user/password')
18+
.send(passwordInfo)
19+
.then(handleSuccess)
20+
.catch(handleError);

Diff for: client/api/users.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import request from 'superagent';
2+
3+
import { handleError, handleSuccess } from '_utils/api';
4+
5+
export const postCheckUsername = username =>
6+
request.post('/api/users/checkusername')
7+
.send({ username })
8+
.then(handleSuccess)
9+
.catch(handleError);

Diff for: client/assets/icons/favicon.ico

3.53 KB
Binary file not shown.

Diff for: client/assets/images/default-profile.png

6.64 KB
Loading

Diff for: client/assets/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Images
2+
import './images/default-profile.png';

Diff for: client/components/elements/Button/Button.js

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import React from 'react';
2+
3+
import classNames from 'classnames';
4+
import PropTypes from 'prop-types';
5+
6+
export default function Button(props) {
7+
const {
8+
className, onClick, label, style, type, size, outlined,
9+
inverted, rounded, hovered, focused, active, loading, disabled,
10+
} = props;
11+
12+
const typeMap = {
13+
info: 'is-info',
14+
primary: 'is-primary',
15+
success: 'is-success',
16+
warning: 'is-warning',
17+
danger: 'is-danger',
18+
};
19+
20+
const sizeMap = {
21+
small: 'is-small',
22+
normal: '',
23+
medium: 'is-medium',
24+
large: 'is-large',
25+
};
26+
27+
const isType = typeMap[type] || 'is-info';
28+
const isSize = sizeMap[size] || '';
29+
30+
const buttonClasses = classNames({
31+
[className]: !!className,
32+
'button': true,
33+
[isType]: true,
34+
[isSize]: true,
35+
'is-outlined': outlined,
36+
'is-inverted': inverted,
37+
'is-rounded': rounded,
38+
'is-hovered': hovered,
39+
'is-focused': focused,
40+
'is-active': active,
41+
'is-loading': loading,
42+
'is-static': props.static,
43+
});
44+
45+
return (
46+
<button
47+
style={style}
48+
type="button"
49+
className={buttonClasses}
50+
onClick={onClick}
51+
disabled={disabled}
52+
>
53+
{label}
54+
</button>
55+
);
56+
}
57+
58+
Button.propTypes = {
59+
className: PropTypes.string,
60+
style: PropTypes.object,
61+
onClick: PropTypes.func,
62+
label: PropTypes.string,
63+
type: PropTypes.string,
64+
size: PropTypes.string,
65+
outlined: PropTypes.bool,
66+
inverted: PropTypes.bool,
67+
rounded: PropTypes.bool,
68+
hovered: PropTypes.bool,
69+
focused: PropTypes.bool,
70+
active: PropTypes.bool,
71+
loading: PropTypes.bool,
72+
static: PropTypes.bool,
73+
disabled: PropTypes.bool,
74+
};
75+
76+
Button.defaultProps = {
77+
className: '',
78+
style: {},
79+
label: '',
80+
type: 'info',
81+
size: 'normal',
82+
onClick: () => {},
83+
outlined: false,
84+
inverted: false,
85+
rounded: false,
86+
hovered: false,
87+
focused: false,
88+
active: false,
89+
loading: false,
90+
static: false,
91+
disabled: false,
92+
};

Diff for: client/components/elements/Button/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Button from './Button';
2+
3+
export default Button;

0 commit comments

Comments
 (0)