diff --git a/source/_posts/2018-11-20-rebuilding-bartik-with-vuejs-tailwind-css.md b/source/_posts/2018-11-20-rebuilding-bartik-with-vuejs-tailwind-css.md index 1c8125d8b..5f427be6c 100644 --- a/source/_posts/2018-11-20-rebuilding-bartik-with-vuejs-tailwind-css.md +++ b/source/_posts/2018-11-20-rebuilding-bartik-with-vuejs-tailwind-css.md @@ -33,6 +33,173 @@ As Tailwind was added via a CDN, there was no opportunity to customise it’s co When I decided that I was going to later add some interactivity onto the mobile navigation menu, the existing code was ported into a new Vue.js application generated by the Vue CLI, with the majority of the markup within a `Welcome` component. This meant that Tailwind was also added as a dependency with it’s own configuration file, though although I had the opportunity to customise it I decided not to and made no changes to it and continued with the default values. +`src/App.vue`: + +``` + + + + + +``` + +`src/components/Welcome.vue`: + +``` + + + + + +``` + +`src/components/DrupalBlock.vue`: + +``` + + + +``` + ## Making it responsive The second stage began with making the existing desktop version responsive - particularly making the navigation menu behave and appear differently on mobile and tablet screens, and stacking the main content area and the sidebar on mobile screens. This was all achieved using Tailwind’s responsive variants. @@ -57,6 +224,94 @@ The code for this was moved into a separate `MainMenu` component, which means th I also moved the links into `data` too - each link is it’s own object with it's `title` and `href` values. This means that I can use a `v-for` directive to loop over the data items and inject dynamic values, removing the duplication of markup which makes the component easier to read and maintain. +`src/components/MainMenu.vue`: + +{% raw %}
+```vuejs + + + +``` +
{% endraw %} + ## The result The whole task only took around two hours to complete, and although some of the colours and spacings are slightly different due to the decision to stick with the default Tailwind configuration values, I’m happy with the result.