Skip to content

Commit 8e8768b

Browse files
authored
Merge pull request #63 from back4app/add-collaborator-permission
Add collaborator permission
2 parents c23f767 + de3c4cf commit 8e8768b

16 files changed

+1307
-58
lines changed

package-lock.json

Lines changed: 31 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"LICENSE"
3434
],
3535
"dependencies": {
36+
"axios": "^0.18.0",
3637
"bcryptjs": "^2.3.0",
3738
"body-parser": "^1.15.2",
3839
"bootstrap": "4.0.0-alpha.6",
@@ -44,11 +45,13 @@
4445
"html-webpack-plugin": "^3.2.0",
4546
"jquery": "^3.2.1",
4647
"json-file-plus": "^3.2.0",
48+
"lodash": "^4.17.10",
4749
"material-design-iconic-font": "^2.2.0",
4850
"package-json": "^4.0.1",
4951
"passport": "^0.3.2",
5052
"passport-local": "^1.0.0",
5153
"popper.js": "^1.12.9",
54+
"react-tabs": "^2.2.2",
5255
"whatwg-fetch": "^2.0.3"
5356
},
5457
"devDependencies": {

src/components/Field/Field.react.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,25 @@ import PropTypes from 'lib/PropTypes';
99
import React from 'react';
1010
import styles from 'components/Field/Field.scss';
1111

12-
let Field = ({label, input, labelWidth = 50, labelPadding, height, className}) => {
12+
let Field = ({label, input, labelWidth = 50, labelPadding, height, className, minHeight}) => {
1313
let classes = [styles.field];
1414
if (className) {
1515
classes.push(className);
1616
}
1717
labelWidth = labelWidth || 50;
18+
minHeight = minHeight || '';
1819
if (label && labelPadding) {
1920
label = React.cloneElement(
2021
label,
2122
{ ...label.props, padding: labelPadding }
2223
);
2324
}
2425
return (
25-
<div className={classes.join(' ')}>
26-
<div className={styles.left} style={{ width: labelWidth + '% ', height: height }}>
26+
<div className={classes.join(' ')} style={{minHeight}}>
27+
<div className={styles.left} style={{ width: labelWidth + '% ', height: height, minHeight }}>
2728
{label}
2829
</div>
29-
<div className={styles.right} style={{ marginLeft: labelWidth + '%', height: height }}>
30+
<div className={styles.right} style={{ marginLeft: labelWidth + '%', height: height, minHeight }}>
3031
{input}
3132
</div>
3233
</div>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2016-present, Parse, LLC
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the license found in the LICENSE file in
6+
* the root directory of this source tree.
7+
*/
8+
import Field from 'components/Field/Field.react';
9+
import FormTableCollab from 'components/FormTableCollab/FormTableCollab.react';
10+
import Label from 'components/Label/Label.react';
11+
import React from 'react';
12+
13+
export const component = FormTableCollab;
14+
15+
export const demos = [
16+
{
17+
render: () => (
18+
<Field
19+
labelWidth={62}
20+
label={<Label text='Label' />}
21+
input={<FormTableCollab
22+
items={[
23+
{
24+
title: 'Title'
25+
},
26+
{
27+
title: 'Title'
28+
},
29+
{
30+
title: 'Title'
31+
},
32+
{
33+
title: 'Title'
34+
}
35+
]} />
36+
}
37+
/>
38+
)
39+
},
40+
{
41+
render: () => (
42+
<Field
43+
label={<Label text='Label' />}
44+
firstInput={<FormTableCollab
45+
keyWidth='150px'
46+
items={[
47+
{
48+
title: 'Title'
49+
},
50+
]} />
51+
} />
52+
)
53+
},
54+
];
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2016-present, Parse, LLC
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the license found in the LICENSE file in
6+
* the root directory of this source tree.
7+
*/
8+
import PropTypes from 'lib/PropTypes';
9+
import React from 'react';
10+
import styles from 'components/FormTableCollab/FormTableCollab.scss';
11+
import Icon from 'components/Icon/Icon.react';
12+
13+
let Row = ({
14+
title,
15+
color = 'blue',
16+
onDelete,
17+
onEdit,
18+
}) => {
19+
return (
20+
<div className={styles.row}>
21+
<div className={styles.header}>
22+
<span className={[styles.indicator, styles[color]].join(' ')} />
23+
<span className={styles.title}>{title}</span>
24+
{typeof onDelete === 'function' ? <a href='javascript:;' role='button' className={styles.icon} onClick={onDelete}><Icon name='trash-solid' fill='#59596e' width={18} height={18} role='button'/></a> : null}
25+
{typeof onEdit === 'function' ? <a href='javascript:;' role='button' className={styles.firstIcon} onClick={onEdit}><Icon name='gear-solid' fill='#59596e' width={18} height={18} role='button'/></a> : null}
26+
</div>
27+
<hr className={styles.hrTableDivisor}/>
28+
</div>
29+
30+
);
31+
};
32+
33+
let FormTableCollab = ({ items, keyWidth = '75px' }) => (
34+
<div className={styles.table}>
35+
{items.map((item, index) => <Row key={index.toString()} keyWidth={keyWidth} {...item} />)}
36+
</div>
37+
);
38+
39+
FormTableCollab.propTypes = {
40+
items: PropTypes.array.isRequired.describe('An array of objects to go in the table. Each object should include a title (string), optional color (blue, red, green, orange), optional onDelete function, and notes (array). Each object in the notes array should contain a key (string), keyColor (blue, red, green, or orange), a value (string), and optionally strong (bool) to use a bold font for the value.'),
41+
};
42+
43+
export default FormTableCollab;

0 commit comments

Comments
 (0)