index.vue 5.4 KB

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