Skip to content

Commit a47c77d

Browse files
committed
Use DashboardCard.vue component on dashboard
1 parent fa54015 commit a47c77d

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

vue/src/views/Dashboard.vue

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,27 @@
55
v-else
66
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5 text-gray-700"
77
>
8-
<div
9-
class="bg-white shadow-md p-3 text-center flex flex-col animate-fade-in-down order-1 lg:order-2"
10-
style="animation-delay: 0.1s"
11-
>
12-
<h3 class="text-2xl font-semibold">Total Surveys</h3>
8+
<DashboardCard class="order-1 lg:order-2" style="animation-delay: 0.1s">
9+
<template v-slot:title>Total Surveys</template>
1310
<div
1411
class="text-8xl pb-4 font-semibold flex-1 flex items-center justify-center"
1512
>
1613
{{ data.totalSurveys }}
1714
</div>
18-
</div>
19-
<div
20-
class="bg-white shadow-md p-3 text-center flex flex-col order-2 lg:order-4 animate-fade-in-down"
21-
style="animation-delay: 0.2s"
22-
>
23-
<h3 class="text-2xl font-semibold">Total Answers</h3>
15+
</DashboardCard>
16+
<DashboardCard class="order-2 lg:order-4" style="animation-delay: 0.2s">
17+
<template v-slot:title>Total Answers</template>
2418
<div
2519
class="text-8xl pb-4 font-semibold flex-1 flex items-center justify-center"
2620
>
2721
{{ data.totalAnswers }}
2822
</div>
29-
</div>
30-
<div
31-
class="row-span-2 animate-fade-in-down order-3 lg:order-1 bg-white shadow-md p-4"
23+
</DashboardCard>
24+
<DashboardCard
25+
class="order-3 lg:order-1 row-span-2"
26+
style="animation-delay: 0.2s"
3227
>
33-
<h3 class="text-2xl font-semibold">Latest Survey</h3>
28+
<template v-slot:title>Latest Survey</template>
3429
<div v-if="data.latestSurvey">
3530
<img
3631
:src="data.latestSurvey.image_url"
@@ -103,23 +98,22 @@
10398
<div v-else class="text-gray-600 text-center py-16">
10499
Your don't have surveys yet
105100
</div>
106-
</div>
107-
<div
108-
class="bg-white shadow-md p-3 row-span-2 order-4 lg:order-3 animate-fade-in-down"
109-
style="animation-delay: 0.3s"
110-
>
111-
<div class="flex justify-between items-center mb-3 px-2">
112-
<h3 class="text-2xl font-semibold">Latest Answers</h3>
101+
</DashboardCard>
102+
<DashboardCard class="order-4 lg:order-3 row-span-2" style="animation-delay: 0.3s">
103+
<template v-slot:title>
104+
<div class="flex justify-between items-center mb-3 px-2">
105+
<h3 class="text-2xl font-semibold">Latest Answers</h3>
113106

114-
<a
115-
href="javascript:void(0)"
116-
class="text-sm text-blue-500 hover:decoration-blue-500"
117-
>
118-
View all
119-
</a>
120-
</div>
107+
<a
108+
href="javascript:void(0)"
109+
class="text-sm text-blue-500 hover:decoration-blue-500"
110+
>
111+
View all
112+
</a>
113+
</div>
114+
</template>
121115

122-
<div v-if="data.latestAnswers.length">
116+
<div v-if="data.latestAnswers.length" class="text-left">
123117
<a
124118
href="#"
125119
v-for="answer of data.latestAnswers"
@@ -136,12 +130,13 @@
136130
<div v-else class="text-gray-600 text-center py-16">
137131
Your don't have answers yet
138132
</div>
139-
</div>
133+
</DashboardCard>
140134
</div>
141135
</PageComponent>
142136
</template>
143137

144138
<script setup>
139+
import DashboardCard from "../components/core/DashboardCard.vue";
145140
import PageComponent from "../components/PageComponent.vue";
146141
import { computed } from "vue";
147142
import { useStore } from "vuex";

0 commit comments

Comments
 (0)