Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

patterns-page.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {PlatformSelect} from './platform-select';
  2. import {ThemeSelect} from './theme-select';
  3. export const PatternsPage = {
  4. props: ['query'],
  5. template: `
  6. <div class="pv-content">
  7. <platform-select :platform="query.platform" />
  8. <h2 class="pv-content__header">Patterns</h2>
  9. <theme-select :query="query" />
  10. <div class="pv-patterns">
  11. <div class="pv-pattern" v-for="pattern in filterPatterns">
  12. <a class="pv-pattern__name pv-title-label" :href="'/patterns/' + pattern.id">{{pattern.name}}</a>
  13. <div class="pv-pattern__example"><div v-html="pattern.markup" style="position: static"></div></div>
  14. </div>
  15. </div>
  16. </div>
  17. `,
  18. data: () => ({
  19. patterns: []
  20. }),
  21. components: {
  22. 'platform-select': PlatformSelect,
  23. 'theme-select': ThemeSelect
  24. },
  25. created() {
  26. // Load patterns data.
  27. this.patterns = window.patterns;
  28. },
  29. computed: {
  30. filterPatterns() {
  31. const patterns = this.patterns;
  32. if (this.query.platform === 'android') {
  33. return patterns.filter(function(pattern) {
  34. return pattern.name.match(/Material/);
  35. });
  36. } else if (this.query.platform === 'ios') {
  37. return patterns.filter(function(pattern) {
  38. return !pattern.name.match(/Material/);
  39. });
  40. }
  41. return patterns;
  42. }
  43. },
  44. };