diff --git a/app/components/Input/Input.js b/app/components/Input/Input.js
index 5fbe3410..7897b3b3 100644
--- a/app/components/Input/Input.js
+++ b/app/components/Input/Input.js
@@ -32,7 +32,7 @@ const Wrapper = styled.div`
`;
-const Outline = styled(Flex)`
+export const Outline = styled(Flex)`
display: flex;
flex: 1;
margin: 0 0 ${size.large};
@@ -48,7 +48,7 @@ const Outline = styled(Flex)`
}
`;
-const LabelText = styled.div`
+export const LabelText = styled.div`
font-weight: 500;
padding-bottom: 4px;
`;
diff --git a/app/components/Input/index.js b/app/components/Input/index.js
index e005a8af..e9b21f08 100644
--- a/app/components/Input/index.js
+++ b/app/components/Input/index.js
@@ -1,3 +1,4 @@
// @flow
-import Input from './Input';
+import Input, { LabelText, Outline } from './Input';
export default Input;
+export { LabelText, Outline };
diff --git a/app/components/Layout/components/SidebarCollections.js b/app/components/Layout/components/SidebarCollections.js
index 45e9e304..9f257e2e 100644
--- a/app/components/Layout/components/SidebarCollections.js
+++ b/app/components/Layout/components/SidebarCollections.js
@@ -100,7 +100,7 @@ type Props = {
}
+ icon={}
>
{collection.name}
diff --git a/app/models/Collection.js b/app/models/Collection.js
index 93923e9c..77158d86 100644
--- a/app/models/Collection.js
+++ b/app/models/Collection.js
@@ -19,6 +19,7 @@ class Collection extends BaseModel {
description: ?string;
id: string;
name: string;
+ color: string;
type: 'atlas' | 'journal';
documents: Array;
updatedAt: string;
@@ -57,19 +58,21 @@ class Collection extends BaseModel {
if (this.isSaving) return this;
this.isSaving = true;
+ const params = {
+ name: this.name,
+ color: this.color,
+ description: this.description,
+ };
+
try {
let res;
if (this.id) {
res = await client.post('/collections.update', {
id: this.id,
- name: this.name,
- description: this.description,
+ ...params,
});
} else {
- res = await client.post('/collections.create', {
- name: this.name,
- description: this.description,
- });
+ res = await client.post('/collections.create', params);
}
runInAction('Collection#save', () => {
invariant(res && res.data, 'Data should be available');
diff --git a/app/models/Document.js b/app/models/Document.js
index 4f4c760e..d882c039 100644
--- a/app/models/Document.js
+++ b/app/models/Document.js
@@ -5,7 +5,7 @@ import invariant from 'invariant';
import { client } from 'utils/ApiClient';
import stores from 'stores';
import ErrorsStore from 'stores/ErrorsStore';
-import parseTitle from '../../shared/parseTitle';
+import parseTitle from '../../shared/utils/parseTitle.js';
import type { User } from 'types';
import BaseModel from './BaseModel';
diff --git a/app/scenes/CollectionEdit/CollectionEdit.js b/app/scenes/CollectionEdit/CollectionEdit.js
index 17fc570b..db5b0711 100644
--- a/app/scenes/CollectionEdit/CollectionEdit.js
+++ b/app/scenes/CollectionEdit/CollectionEdit.js
@@ -7,6 +7,7 @@ import Button from 'components/Button';
import Input from 'components/Input';
import Flex from 'shared/components/Flex';
import HelpText from 'components/HelpText';
+import ColorPicker from 'components/ColorPicker';
import Collection from 'models/Collection';
type Props = {
@@ -18,6 +19,7 @@ type Props = {
@observer class CollectionEdit extends Component {
props: Props;
@observable name: string;
+ @observable color: string = '';
@observable isSaving: boolean;
componentWillMount() {
@@ -28,7 +30,7 @@ type Props = {
ev.preventDefault();
this.isSaving = true;
- this.props.collection.updateData({ name: this.name });
+ this.props.collection.updateData({ name: this.name, color: this.color });
const success = await this.props.collection.save();
if (success) {
@@ -42,6 +44,10 @@ type Props = {
this.name = ev.target.value;
};
+ handleColor = (color: string) => {
+ this.color = color;
+ };
+
render() {
return (
@@ -58,6 +64,10 @@ type Props = {
required
autoFocus
/>
+