doesitarm/pages/categories.vue
2020-11-28 15:00:47 -06:00

113 lines
3.5 KiB
Vue

<template>
<section class="container py-24">
<div class="flex flex-col">
<h1 class="title text-2xl leading-tight mb-6">
Categories
</h1>
<div class="line-separator border-white border-t-2 mb-12" />
<!-- sectionList: {{ sectionList }} -->
<ul class="categories-list space-y-3">
<li
v-for="(section, i) in sectionList"
:key="`${section.slug}-${i}`"
:ref="`${section.slug}-row`"
class="relative"
>
<!-- section.endpoint: {{ section.endpoint }} -->
<a
:href="`/kind/${section.slug}`"
class="flex justify-start items-center inset-x-0 text-3xl md:text-4xl hover:bg-darkest border-2 border-white border-opacity-0 hover:border-opacity-50 focus:outline-none focus:bg-gray-50 duration-300 ease-in-out rounded-lg space-x-3 -mx-5 px-5 md:pr-64 py-3"
style="transition-property: border;"
>
<div class="font-hairline">
<div>{{ section.label }}</div>
<div class="text-xs opacity-75 mb-3">{{ section.appNames }}</div>
</div>
<div></div>
</a>
</li>
</ul>
</div>
</section>
</template>
<script>
import Search from '~/components/search.vue'
import LinkButton from '~/components/link-button.vue'
// import appList from '~/static/app-list.json'
// import gamelist from '~/static/game-list.json'
export default {
async asyncData () {
// const { default: appList } = await import('~/static/app-list.json')
// const { default: gamelist } = await import('~/static/game-list.json')
const { allList } = await import('~/helpers/get-list.js')
const { categories } = await import('~/helpers/categories.js')
const sectionList = {}
allList.forEach( app => {
// Find and store all sections
// console.log('app.section.slug', app.section.slug)
if (sectionList.hasOwnProperty(app.section.slug)) {
sectionList[app.section.slug].appNamesList.push(app.name)
return
}
sectionList[app.section.slug] = {
...categories[app.section.slug],
appNamesList: [ app.name ]
}
})
// Add App Names Text into sectionList
Object.keys(sectionList).map(function(key, index) {
const section = sectionList[key]
sectionList[key] = {
...section,
appNames: section.appNamesList.slice(0, 25).join(', ') + ', etc...'
}
});
return {
sectionList
}
},
components: {
Search,
LinkButton
},
data: function () {
return {}
},
// computed: {
// sectionList () {
// return sectionList
// }
// },
head() {
return {
title: `Categories of App Support for Apple Silicon - Does It ARM`,
// meta: [
// // hid is used as unique identifier. Do not use `vmid` for it as it will not work
// {
// hid: 'description',
// name: 'description',
// content: 'My custom description'
// }
// ]
}
}
}
</script>