Add the ProjectViewSwitcher component
This commit is contained in:
parent
9d508f806b
commit
635799e60a
6
src/components/ProjectViewSwitcher.vue
Normal file
6
src/components/ProjectViewSwitcher.vue
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<button type="button" @click="$emit('changed', 'grid')">Grid</button>
|
||||||
|
<button type="button" @click="$emit('changed', 'list')" class="ml-2">List</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -26,13 +26,17 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="max-w-6xl mx-auto p-6 xl:px-0">
|
<div class="max-w-6xl mx-auto p-6 xl:px-0">
|
||||||
<page-title class="mb-6">All Projects</page-title>
|
<div class="flex justify-between items-baseline">
|
||||||
|
<page-title class="mb-6">All Projects</page-title>
|
||||||
|
|
||||||
<div v-if="display == 'grid'" class="flex flex-wrap mt-4 -mx-4 -mb-8">
|
<project-view-switcher @changed="projectViewSwitched"></project-view-switcher>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="displayMode == 'grid'" class="flex flex-wrap mt-4 -mx-4 -mb-8">
|
||||||
<project-card v-for="n in 9" :key="n"></project-card>
|
<project-card v-for="n in 9" :key="n"></project-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="display == 'list'" class="bg-white shadow-md pt-6 pb-6">
|
<div v-if="displayMode == 'list'" class="bg-white shadow-md pt-6 pb-6 mt-4">
|
||||||
<table class="w-full">
|
<table class="w-full">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="border-b border-gray-300">
|
<tr class="border-b border-gray-300">
|
||||||
|
@ -63,19 +67,26 @@
|
||||||
<script>
|
<script>
|
||||||
import ProjectCard from '@/components/ProjectCard'
|
import ProjectCard from '@/components/ProjectCard'
|
||||||
import ProjectSearch from '@/components/ProjectSearch'
|
import ProjectSearch from '@/components/ProjectSearch'
|
||||||
|
import ProjectViewSwitcher from '@/components/ProjectViewSwitcher'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'projects',
|
name: 'projects',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
ProjectCard,
|
ProjectCard,
|
||||||
ProjectSearch
|
ProjectSearch,
|
||||||
|
ProjectViewSwitcher
|
||||||
},
|
},
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
display: 'grid'
|
displayMode: 'grid'
|
||||||
// display: 'list'
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
projectViewSwitched (mode) {
|
||||||
|
this.displayMode = mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue