From 2a77bb8a2c44ebc8ef23b9a29ce399692c385a09 Mon Sep 17 00:00:00 2001 From: imkieransmith Date: Mon, 27 Apr 2020 23:39:38 +0100 Subject: [PATCH 1/7] Extract routes to minimise category route duplication --- src/router.js | 149 +++++++++++++++++++++++++++----------------------- 1 file changed, 80 insertions(+), 69 deletions(-) diff --git a/src/router.js b/src/router.js index 271de2b..88e9ab5 100644 --- a/src/router.js +++ b/src/router.js @@ -3,80 +3,91 @@ import Router from 'vue-router' Vue.use(Router) -const router = new Router({ - mode: 'history', - base: process.env.BASE_URL, - scrollBehavior: () => ({ y: 0 }), - routes: [ - { - path: '/', - name: 'Home', - component: () => - import(/* webpackChunkName: "Home" */ './views/home/Index'), - }, - { - path: '/about', - name: 'About', - component: () => - import(/* webpackChunkName: "About" */ './views/about/Index'), - }, - { - path: '/storybook-alike', - name: 'StorybookAlike', - component: () => - import(/* webpackChunkName: "StorybookAlike" */ './views/storybookalike/Index'), - }, - { - path: '/tags', - name: 'TagIndex', - component: () => - import(/* webpackChunkName: "TagIndex" */ './views/tags/Index'), - }, - { - path: '/tags/:tagSlug', - name: 'TagShow', - component: () => - import(/* webpackChunkName: "TagShow" */ './views/tags/Show'), - }, - { - path: '/actions', - name: 'ActionIndex', - component: () => - import(/* webpackChunkName: "ActionIndex" */ './views/actions/Index'), - }, - { - path: '/actions/:actionSlug', - name: 'ActionShow', - component: () => - import(/* webpackChunkName: "ActionShow" */ './views/actions/Show'), - }, - { - path: '/categories', - name: 'CategoryIndex', - component: () => - import(/* webpackChunkName: "CategoryIndex" */ './views/categories/Index'), - }, - { - path: '/categories/:categorySlug', - name: 'CategoryShow', - component: () => - import(/* webpackChunkName: "CategoryShow" */ './views/categories/Show'), - }, +// Base routes. +const routes = [ + { + path: '/', + name: 'Home', + component: () => + import(/* webpackChunkName: "Home" */ './views/home/Index'), + }, + { + path: '/about', + name: 'About', + component: () => + import(/* webpackChunkName: "About" */ './views/about/Index'), + }, + { + path: '/storybook-alike', + name: 'StorybookAlike', + component: () => + import(/* webpackChunkName: "StorybookAlike" */ './views/storybookalike/Index'), + }, + { + path: '/tags', + name: 'TagIndex', + component: () => + import(/* webpackChunkName: "TagIndex" */ './views/tags/Index'), + }, + { + path: '/tags/:tagSlug', + name: 'TagShow', + component: () => + import(/* webpackChunkName: "TagShow" */ './views/tags/Show'), + }, + { + path: '/categories', + name: 'CategoryIndex', + component: () => + import(/* webpackChunkName: "CategoryIndex" */ './views/categories/Index'), + }, + { + path: '/search', + name: 'SearchIndex', + component: () => + import(/* webpackChunkName: "SearchIndex" */ './views/search/Index'), + }, + { + path: '/search/:searchTerm', + name: 'SearchQuery', + component: () => + import(/* webpackChunkName: "SearchQuery" */ './views/search/Query'), + }, +]; + + +// Array of information for all categories in the API. +let categories = [ { - path: '/search', - name: 'SearchIndex', - component: () => - import(/* webpackChunkName: "SearchIndex" */ './views/search/Index'), + id: '207559a4-fe66-4c3d-bc6c-4f721f9562a4', + slug: 'carbon-reduction' }, { - path: '/search/:searchTerm', - name: 'SearchQuery', - component: () => - import(/* webpackChunkName: "SearchQuery" */ './views/search/Query'), - }, - ], + id: 'f92ca585-ad4d-43bc-9430-43c2fad14aa1', + slug: 'clothing' + } +]; + +// Create router objects for each category. +categories = categories.map(function(category) { + return { + path: '/' + category.slug, + name: 'SingleCategoryIndex', + component: () => import(/* webpackChunkName: "SingleCategoryIndex" */ './views/category/Index'), + props: { category: category } + }; +}); + + +const router = new Router({ + //mode: 'history', + base: process.env.BASE_URL, + scrollBehavior: () => ({ y: 0 }), + // Merge base routes and category routes. + routes: routes.concat(categories) }) + // Bootstrap Analytics // Set in .env // https://github.com/MatteoGabriele/vue-analytics From c1e55d1f447fa0896c38f03bb4007c486d827860 Mon Sep 17 00:00:00 2001 From: imkieransmith Date: Mon, 27 Apr 2020 23:40:02 +0100 Subject: [PATCH 2/7] Load category, featured actions, and regular actions from API --- src/views/category/Index.vue | 89 ++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/views/category/Index.vue diff --git a/src/views/category/Index.vue b/src/views/category/Index.vue new file mode 100644 index 0000000..1d6e1cf --- /dev/null +++ b/src/views/category/Index.vue @@ -0,0 +1,89 @@ + + + From d04919c6d4070b94a99dcc14e37543aabe672fce Mon Sep 17 00:00:00 2001 From: imkieransmith Date: Fri, 1 May 2020 21:59:21 +0100 Subject: [PATCH 3/7] Styling Tailwind doesn't support --- src/assets/main.css | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/assets/main.css b/src/assets/main.css index db8e33a..c5bd8f5 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -10,4 +10,27 @@ a { @apply text-pink-500; } +.written > h1 { + @apply text-2xl mb-4; +} +.written > p:not(:last-child) { + @apply mb-4; +} + +.image-left-side:after { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: linear-gradient(45deg, rgba(42, 67, 101, 0.85), rgba(42, 67, 101, 0.25)); + border-radius: 0.375rem; +} +@media screen and (min-width: 768px) { + .image-left-side:after { + background: linear-gradient(45deg, rgba(42, 67, 101, 0.85), rgba(42, 67, 101, 0)); + } +} + @tailwind utilities; From a1581c13279fdd36fb85e1bcc9fe23ee50de12eb Mon Sep 17 00:00:00 2001 From: imkieransmith Date: Fri, 1 May 2020 21:59:30 +0100 Subject: [PATCH 4/7] Swap back to history mode --- src/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router.js b/src/router.js index 88e9ab5..246c2e9 100644 --- a/src/router.js +++ b/src/router.js @@ -80,7 +80,7 @@ categories = categories.map(function(category) { const router = new Router({ - //mode: 'history', + mode: 'history', base: process.env.BASE_URL, scrollBehavior: () => ({ y: 0 }), // Merge base routes and category routes. From 6e1e47251ed6774236a4bd7014012e6339624294 Mon Sep 17 00:00:00 2001 From: imkieransmith Date: Fri, 1 May 2020 22:00:37 +0100 Subject: [PATCH 5/7] Restructure banner and finalise action styling --- src/views/category/Index.vue | 91 ++++++++++++++++++++++++++++++------ 1 file changed, 78 insertions(+), 13 deletions(-) diff --git a/src/views/category/Index.vue b/src/views/category/Index.vue index 1d6e1cf..a958db6 100644 --- a/src/views/category/Index.vue +++ b/src/views/category/Index.vue @@ -3,27 +3,92 @@ -
-
-
-

-
-
-
- +
+ +
+
+ +
+ +
+ +
+

+

+
+ + +
+ +
+ +
+ +
+
+
-