This repository has been archived by the owner on Oct 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic sidebar with TagsInform, SidebarMenu and Bookmarks
- Loading branch information
1 parent
3fcb008
commit 08c8c09
Showing
29 changed files
with
1,142 additions
and
512 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
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,64 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React, { PropTypes } from 'react'; | ||
|
||
import NavigationItem from '../navigation-item'; | ||
import Icon from '../icon'; | ||
|
||
/** | ||
* An example of bookmark object | ||
{ | ||
className: 'navigation-item--color_blue', | ||
to: '/bookmark-url', | ||
title: 'Bookmark Example', | ||
icon: { icon: 'public' } | ||
} | ||
**/ | ||
|
||
export default class Bookmark extends React.Component { | ||
static propTypes = { | ||
i: PropTypes.number, | ||
onSettingsClick: PropTypes.func, | ||
title: PropTypes.string | ||
}; | ||
|
||
static defaultProps = { | ||
onSettingsClick: () => {} | ||
}; | ||
|
||
handleSettingsClick = (e) => { | ||
const { i, onSettingsClick } = this.props; | ||
|
||
e.preventDefault(); | ||
onSettingsClick(i); | ||
}; | ||
|
||
render() { | ||
const { title, ...props } = this.props; | ||
|
||
return ( | ||
<NavigationItem | ||
badge={<Icon icon="settings" onClick={this.handleSettingsClick} />} | ||
theme="2.0" | ||
{...props} | ||
> | ||
{title} | ||
</NavigationItem> | ||
); | ||
} | ||
} |
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
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,22 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import Bookmarks from './bookmarks'; | ||
import Bookmark from './bookmark'; | ||
|
||
export { Bookmark }; | ||
export default Bookmarks; |
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,84 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React, { PropTypes } from 'react'; | ||
import { form as inform, from } from 'react-inform'; | ||
|
||
import Message from '../message'; | ||
|
||
class BookmarkSettingsForm extends React.Component { | ||
static propTypes = { | ||
fields: PropTypes.shape({}), | ||
form: PropTypes.shape({}), | ||
onSave: PropTypes.func, | ||
title: PropTypes.string, | ||
to: PropTypes.string | ||
}; | ||
|
||
static defaultProps = { | ||
onSave: () => {} | ||
}; | ||
|
||
componentDidMount() { | ||
const { form, title, to } = this.props; | ||
|
||
form.onValues({ title, to }); | ||
} | ||
|
||
handleSubmit = (e) => { | ||
e.preventDefault(); | ||
|
||
const { form, onSave } = this.props; | ||
|
||
form.forceValidate(); | ||
if (!form.isValid()) { | ||
return; | ||
} | ||
|
||
const newValues = form.values(); | ||
onSave(newValues); | ||
}; | ||
|
||
render() { | ||
const { fields } = this.props; | ||
|
||
return ( | ||
<form onSubmit={this.handleSubmit}> | ||
<div className="layout__row"> | ||
<input {...fields.title} /> | ||
{fields.title.error && | ||
<Message message={fields.title.error} /> | ||
} | ||
</div> | ||
<div className="layout__row"> | ||
<input {...fields.title} /> | ||
{fields.to.error && | ||
<Message message={fields.to.error} /> | ||
} | ||
</div> | ||
</form> | ||
); | ||
} | ||
} | ||
|
||
const WrappedBookmarkSettingsForm = inform(from({ | ||
icon: {}, | ||
title: {}, | ||
to: {} | ||
}))(BookmarkSettingsForm); | ||
|
||
export default WrappedBookmarkSettingsForm; |
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,48 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React, { PropTypes } from 'react'; | ||
|
||
import BookmarkSettingsForm from './settings-form'; | ||
import Modal from '../modal-component'; | ||
|
||
const BookmarkSettingsModal = ({ onClose, onSave, ...props }) => { | ||
return ( | ||
<Modal {...props} onClose={onClose}> | ||
<Modal.Head> | ||
Bookmark settings | ||
</Modal.Head> | ||
<Modal.Body> | ||
<BookmarkSettingsForm | ||
onSave={onSave} | ||
/> | ||
</Modal.Body> | ||
</Modal> | ||
); | ||
}; | ||
|
||
BookmarkSettingsModal.propTypes = { | ||
onClose: PropTypes.func, | ||
onSave: PropTypes.func | ||
}; | ||
|
||
BookmarkSettingsModal.defaultProps = { | ||
onClose: () => {}, | ||
onSave: () => {} | ||
}; | ||
|
||
export default BookmarkSettingsModal; |
Oops, something went wrong.