-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add logic for posts and comments #3
base: master
Are you sure you want to change the base?
Conversation
src/components/AppLayoutNavbar.vue
Outdated
@@ -26,6 +35,13 @@ | |||
]), | |||
subredditTitle () { | |||
return this.selectedSubreddit ? `- ${this.selectedSubreddit}` : '' | |||
}, | |||
isHome () { | |||
if (this.$route.name === 'Subreddit') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant construction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, can we do it some other, more beautiful way (no === 'Subreddit)?
@@ -37,5 +53,8 @@ | |||
</script> | |||
|
|||
<style> | |||
|
|||
.back-button { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe, vuetify has some prebuild button? explore it's docs
src/components/CommentsItem.vue
Outdated
|
||
<script> | ||
export default { | ||
name: 'CommentsItem', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to SelectedPostComment
src/components/PostsItem.vue
Outdated
import CommentsItem from './CommentsItem' | ||
|
||
export default { | ||
name: 'PostsItem', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to SelectedPost
src/components/PostsItem.vue
Outdated
}, | ||
computed: { | ||
...mapGetters('posts', { | ||
openedPost: 'openedPost', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selectedPost
src/router/index.js
Outdated
{ | ||
path: '/:id', | ||
name: 'Post', | ||
component: PostsItem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename everywhere
src/components/PostsItem.vue
Outdated
@@ -0,0 +1,63 @@ | |||
<template> | |||
<div class="posts-item"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Play with vuetify components - everything might look much better (cards, panels etc)
src/components/PostsItem.vue
Outdated
@@ -0,0 +1,63 @@ | |||
<template> | |||
<div class="posts-item"> | |||
<h1>{{ openedPost.title }}</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it good to split Post component to wrapper, body (3 types) and comments list?
src/components/CommentsItem.vue
Outdated
@@ -0,0 +1,33 @@ | |||
<template> | |||
<div class="comments-item"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
play with styles - no border bottom, no strange icon. Some user info (eg name, time, upvotes - inspire from reddit and ionic2-reddit-reader)
Collapse/expand would be good
src/store/modules/posts.js
Outdated
@@ -5,14 +5,22 @@ export default { | |||
state: { | |||
error: null, | |||
isLoading: false, | |||
posts: [] | |||
openedPost: localStorage.getItem('openedPost') ? JSON.parse(localStorage.getItem('openedPost')) : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think we need local storage here
close #1
close #2