From 0324decae309f05c042e64ab152bea5937eef44a Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 25 Nov 2016 18:36:45 -0300 Subject: [PATCH 01/16] Max - WIP --- client/src/app-components/topic-viewer.js | 29 ++++++ client/src/app-components/topic-viewer.scss | 35 +++++++ .../articles/admin-panel-list-articles.js | 34 ++++++- client/src/core-components/icon.js | 3 +- client/src/data/fixtures/article-fixtures.js | 99 +++++++++++++++++++ client/src/lib-app/fixtures-loader.js | 1 + 6 files changed, 199 insertions(+), 2 deletions(-) create mode 100644 client/src/app-components/topic-viewer.js create mode 100644 client/src/app-components/topic-viewer.scss create mode 100644 client/src/data/fixtures/article-fixtures.js diff --git a/client/src/app-components/topic-viewer.js b/client/src/app-components/topic-viewer.js new file mode 100644 index 00000000..bf93ccbd --- /dev/null +++ b/client/src/app-components/topic-viewer.js @@ -0,0 +1,29 @@ +import React from 'react' +import Icon from 'core-components/icon' + +class TopicViewer extends React.Component { + static propTypes = { + name: React.PropTypes.string.isRequired, + icon: React.PropTypes.string.isRequired, + iconColor: React.PropTypes.string.isRequired, + articles: React.PropTypes.array.isRequired + }; + + render() { + return ( +
+
+ + {this.props.name} +
+ +
+ ); + } +} + +export default TopicViewer; \ No newline at end of file diff --git a/client/src/app-components/topic-viewer.scss b/client/src/app-components/topic-viewer.scss new file mode 100644 index 00000000..abb13971 --- /dev/null +++ b/client/src/app-components/topic-viewer.scss @@ -0,0 +1,35 @@ +@import "../scss/vars"; + +.topic-viewer { + text-align: left; + //font-weight: bold; + &__header { + margin-bottom: 15px; + } + &__icon { + color: $primary-green; + } + &__title { + font-size: $font-size--lg; + margin-left: 15px; + } + &__list { + &-item { + display: inline-block; + width: 50%; + color: $secondary-blue; + margin-bottom: 10px; + } + &-item:before { + content: "• "; + color: $grey; + } + // + &-item:nth-child(even) { + //background: red; + } + &-item:nth-child(odd) { + //background: green; + } + } +} \ No newline at end of file diff --git a/client/src/app/admin/panel/articles/admin-panel-list-articles.js b/client/src/app/admin/panel/articles/admin-panel-list-articles.js index cb607d94..401326e6 100644 --- a/client/src/app/admin/panel/articles/admin-panel-list-articles.js +++ b/client/src/app/admin/panel/articles/admin-panel-list-articles.js @@ -1,14 +1,46 @@ import React from 'react'; +import API from 'lib-app/api-call'; +import TopicViewer from 'app-components/topic-viewer'; + class AdminPanelListArticles extends React.Component { + state = { + loading: true, + topics: [] + }; + + componentDidMount() { + API.call({ + path: '/article/get-all', + data: {} + }).then(this.onRetrieveSuccess.bind(this)); + } + render() { return (
- /admin/panel/articles/list-articles + {this.state.loading ? 'loading' : this.renderTopics()}
); } + + renderTopics() { + return ( +
+ {this.state.topics.map(function (topic) { + return + })} +
+ ) + } + + onRetrieveSuccess(result) { + this.setState({ + loading: false, + topics: result.data + }); + } } export default AdminPanelListArticles; \ No newline at end of file diff --git a/client/src/core-components/icon.js b/client/src/core-components/icon.js index 6570bd90..d26123d1 100644 --- a/client/src/core-components/icon.js +++ b/client/src/core-components/icon.js @@ -5,6 +5,7 @@ class Icon extends React.Component { static propTypes = { name: React.PropTypes.string.isRequired, + color: React.PropTypes.string, size: React.PropTypes.string }; @@ -18,7 +19,7 @@ class Icon extends React.Component { renderFontIcon() { return ( -