index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div>
  3. <div class="main-content">
  4. <div class="container">
  5. <div class="columns is-mobile">
  6. <!-- posts -->
  7. <div class="column is-8">
  8. <div
  9. v-for="blog in publishedBlogs"
  10. :key="blog._id"
  11. class="section">
  12. <div class="post">
  13. <div @click="$router.push(`/blogs/${blog.slug}`)" class="post-header clickable">
  14. <h4 class="title is-4">{{blog.title}}</h4>
  15. <h5 class="subtitle is-5">{{blog.subtitle}}</h5>
  16. </div>
  17. <div class="post-content">
  18. by {{blog.author.name}}, {{blog.createdAt | formatDate}}
  19. </div>
  20. </div>
  21. </div>
  22. <!-- end of blog -->
  23. <!-- pagination -->
  24. <div class="section">
  25. </div>
  26. <!-- end of pagination -->
  27. </div>
  28. <!-- side bar -->
  29. <div class="column is-4 is-narrow">
  30. <!-- featured -->
  31. <div class="section">
  32. <div class="sidebar">
  33. <div class="sidebar-header">
  34. <h4 class="title is-4">Featured Posts</h4>
  35. </div>
  36. <div class="sidebar-list">
  37. <!-- Featured Blogs -->
  38. <p
  39. v-for="fBlog in featuredBlogs"
  40. :key="fBlog._id">
  41. <nuxt-link :to="`/blogs/${fBlog.slug}`">
  42. {{fBlog.title}}
  43. </nuxt-link>
  44. </p>
  45. <!-- Featured Blogs -->
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <!-- end of side bar -->
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import { mapState } from 'vuex';
  58. export default {
  59. computed: {
  60. ...mapState({
  61. publishedBlogs: state => state.blog.items.all,
  62. featuredBlogs: state => state.blog.items.featured,
  63. })
  64. },
  65. async fetch({store}) {
  66. await store.dispatch('blog/fetchBlogs')
  67. await store.dispatch('blog/fetchFeaturedBlogs', {'filter[featured]': true})
  68. }
  69. }
  70. </script>
  71. <style scoped>
  72. .post-content {
  73. font-style: italic;
  74. }
  75. .pagination-content {
  76. display: flex;
  77. justify-content: flex-end;
  78. }
  79. .clickable {
  80. cursor: pointer;
  81. }
  82. #root {
  83. flex: 1 0 auto;
  84. }
  85. *:focus {
  86. outline: none;
  87. }
  88. a {
  89. transition: all .35s;
  90. color: #000;
  91. }
  92. .button:focus {
  93. border-color: #d74436;
  94. box-shadow: 0 0 0 0;
  95. }
  96. .input, .textarea, .input[type] {
  97. font-size: 1.1rem;
  98. }
  99. .input:focus, .textarea:focus, .input[type]:focus {
  100. border: 2px solid #d74436;
  101. }
  102. /* this is used when inline-styled content
  103. overlaps text backgrounds in a really ugly way */
  104. .buffer {
  105. padding-bottom: 1.1rem;
  106. }
  107. /* navigation */
  108. .nav {
  109. background-color: #0d0c0d;
  110. }
  111. .nav-left {
  112. padding-left: 2rem;
  113. }
  114. .nav-right, .nav-center {
  115. padding-right: 2rem;
  116. }
  117. a.nav-item.is-tab {
  118. font-weight: 700;
  119. font-size: 13px;
  120. text-transform: uppercase;
  121. color: #fff;
  122. padding: 0.4rem;
  123. }
  124. a.nav-item:hover {
  125. color: #d74436;
  126. }
  127. a.nav-item.is-tab:hover {
  128. border-bottom: 4px solid #d74436;
  129. }
  130. /* main content */
  131. .main-content {
  132. padding: 4rem 0 2rem 0;
  133. min-height: 800px
  134. }
  135. .main-content .container {
  136. padding: 0 2rem 2rem 2rem;
  137. }
  138. /* section */
  139. .section {
  140. padding: 0 0 2rem 0;
  141. }
  142. .section-header {
  143. padding-bottom: 3rem;
  144. }
  145. .section-header .title {
  146. text-transform: uppercase;
  147. color: #4a4a4a;
  148. font-size: 1.3rem;
  149. }
  150. .section-header a {
  151. color: #d74436;
  152. font-weight: 700;
  153. }
  154. .section-header a:hover {
  155. color: #e50076;
  156. }
  157. /* sidebar */
  158. .sidebar-header {
  159. border-color: #d74436;
  160. padding-bottom: 1rem;
  161. border-bottom: 4px solid #d74436;
  162. }
  163. .sidebar-header .title, .sidebar-header-single .title {
  164. font-weight: 700;
  165. text-transform: uppercase;
  166. font-size: 1.3rem;
  167. }
  168. .sidebar-list p, .sidebar-list-single p {
  169. font-size: 1.1rem;
  170. font-weight: 300;
  171. padding-bottom: 0.8rem;
  172. }
  173. .sidebar-list a {
  174. color: #4a4a4a;
  175. }
  176. .sidebar-list, .post-content, .sidebar-list-single {
  177. padding-top: 1.4rem;
  178. }
  179. .sidebar-list-nav {
  180. padding-top: 1rem;
  181. }
  182. .sidebar-list-nav .is-tab {
  183. padding-right: 1rem;
  184. }
  185. .sidebar-footer-single {
  186. padding-top: 2rem;
  187. }
  188. .sidebar-footer-single a {
  189. color: #000;
  190. font-weight: 700;
  191. text-transform: uppercase;
  192. font-size: 1.1rem;
  193. border-right: 4px solid #d74436;
  194. padding-right: 1rem;
  195. }
  196. .sidebar-footer-single a:hover {
  197. color: #363636;
  198. }
  199. /* post */
  200. .post-header, .sidebar-header-single {
  201. border-color: #d74436;
  202. padding-left: 1rem;
  203. border-left: 4px solid #d74436;
  204. }
  205. .post-header .title {
  206. font-weight: 700;
  207. font-size: 1.8rem;
  208. color: rgba(0,0,0,.84)!important;
  209. fill: rgba(0,0,0,.84)!important;
  210. }
  211. .post-header .subtitle, .sidebar-header-single .subtitle {
  212. font-size: 1.1rem;
  213. }
  214. .post-content p, .post-single-content p {
  215. margin-bottom: 0.8rem;
  216. }
  217. .post-content, .post-single-content {
  218. font-size: 1.1rem;
  219. font-weight: 300;
  220. }
  221. /* override */
  222. .post-single-content form p:nth-child(even) {
  223. border-right: 0;
  224. }
  225. .post-single-content form label {
  226. text-transform: uppercase;
  227. color: #4a4a4a;
  228. padding-bottom: 0.2rem;
  229. }
  230. .post-single-content form .input[type] {
  231. padding-top: 0.2rem;
  232. }
  233. .post-single-content p:nth-child(even) {
  234. border-right: 4px solid #d74436;
  235. padding-right: 1rem;
  236. }
  237. .post-content a {
  238. color: #d74436;
  239. }
  240. .card-content-form form {
  241. padding-top: 1.5rem;
  242. }
  243. .post-footer {
  244. padding: 1.5rem 0 0 0;
  245. }
  246. /* pagination */
  247. .pagination-content {
  248. border-right: 4px solid #d74436;
  249. padding-right: 1rem;
  250. }
  251. .pagination-link.is-current {
  252. background-color: #d74436;
  253. border-color: #d74436;
  254. }
  255. </style>