Skip to content

Commit 3f83eff

Browse files
committed
Add vue-resize-text. Change Dashboard
1 parent 476249f commit 3f83eff

File tree

5 files changed

+68
-45
lines changed

5 files changed

+68
-45
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"core-js": "^3.6.5",
1313
"vue": "^2.6.11",
1414
"vue-apollo": "^3.0.0-beta.11",
15+
"vue-resize-text": "^0.1.1",
1516
"vue-router": "^3.2.0",
1617
"vuetify": "^2.4.0",
1718
"vuex": "^3.4.0"

src/components/DashboardCardNumber.vue

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
2-
<v-card class="mt-7 mx-auto">
2+
<v-card class="mx-auto">
33
<v-row>
44
<v-col class="text-center mb-0 pb-0" cols="4">
55
<v-sheet
66
class="v-sheet--offset ml-3"
7-
height="88"
8-
width="88"
7+
height="80"
8+
width="80"
99
rounded
1010
:color="color"
1111
elevation="12"
@@ -20,9 +20,9 @@
2020
</v-container>
2121
</v-sheet>
2222
</v-col>
23-
<v-col cols="8" class="mb-0 pb-0">
23+
<v-col cols="8" class="mb-0 pb-0 text-center">
2424
<v-card-text class="pt-0">
25-
<div class="title font-weight-light mb-2 text-center text-no-wrap">
25+
<div v-resize-text="{ratio:0.7, minFontSize: '16px', maxFontSize: '26px', delay:0}" class="font-weight-light mx-2 mb-2 text-center text-no-wrap title-color">
2626
{{ title }}
2727
</div>
2828
<div class="headline font-weight-medium grey--text text-center">
@@ -39,17 +39,23 @@
3939
>
4040
mdi-clock
4141
</v-icon>
42-
<span class="caption grey--text font-weight-light">{{ captionText }}</span>
42+
<span class="caption grey--text font-weight-light">{{ caption }}</span>
4343
</v-card-text>
4444
</v-col>
4545
</v-row>
4646
</v-card>
4747
</template>
4848

4949
<script>
50+
import ResizeText from 'vue-resize-text'
51+
5052
export default {
5153
name: 'DashboardCardNumber',
5254
55+
directives: {
56+
ResizeText
57+
},
58+
5359
props: {
5460
title: {
5561
type: String
@@ -60,7 +66,7 @@ export default {
6066
icon: {
6167
type: String
6268
},
63-
captionText: {
69+
caption: {
6470
type: String
6571
},
6672
color: {
@@ -77,4 +83,7 @@ export default {
7783
top: -20px;
7884
position: relative;
7985
}
86+
.title-color {
87+
color: #7d7b7b;
88+
}
8089
</style>

src/components/DashboardUserRegistrations.vue renamed to src/components/DashboardSparkline.vue

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<template>
22
<v-card
3-
class="mt-6 mx-auto"
3+
class="mx-auto"
44
>
55
<v-sheet
66
class="v-sheet--offset mx-auto"
7-
color="#18aa5e"
7+
:color="color"
88
elevation="12"
99
max-width="calc(100% - 32px)"
1010
>
1111
<v-sparkline
1212
:labels="labels"
13-
:value="value"
13+
:value="values"
1414
color="white"
1515
line-width="2"
1616
padding="16"
@@ -19,10 +19,10 @@
1919

2020
<v-card-text class="pt-0">
2121
<div class="title font-weight-light mb-2">
22-
Usuarios Registrados
22+
{{ title }}
2323
</div>
2424
<div class="subheading font-weight-light grey--text">
25-
Últimas 24 horas
25+
{{ subtitle }}
2626
</div>
2727
<v-divider class="my-2"></v-divider>
2828
<v-icon
@@ -31,37 +31,38 @@
3131
>
3232
mdi-clock
3333
</v-icon>
34-
<span class="caption grey--text font-weight-light">último registro hace 12 minutos</span>
34+
<span class="caption grey--text font-weight-light">{{ caption }}</span>
3535
</v-card-text>
3636
</v-card>
3737
</template>
3838

3939
<script>
4040
export default {
41-
name: 'DashboardUserRegistrations',
41+
name: 'DashboardSparkline',
4242
43-
data: () => ({
44-
labels: [
45-
'12am',
46-
'3am',
47-
'6am',
48-
'9am',
49-
'12pm',
50-
'3pm',
51-
'6pm',
52-
'9pm'
53-
],
54-
value: [
55-
200,
56-
675,
57-
410,
58-
390,
59-
310,
60-
460,
61-
250,
62-
240
63-
]
64-
})
43+
props: {
44+
title: {
45+
type: String
46+
},
47+
subtitle: {
48+
type: String,
49+
default: 'En las últimas 12 horas'
50+
},
51+
caption: {
52+
type: String
53+
},
54+
color: {
55+
type: String
56+
},
57+
labels: {
58+
type: Array
59+
},
60+
values: {
61+
type: Array
62+
}
63+
},
64+
65+
data: () => ({})
6566
}
6667
</script>
6768

src/views/Dashboard.vue

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,43 @@
11
<template>
22
<v-container>
3-
<v-row>
3+
<v-row class="my-3">
44
<v-col cols="3">
5-
<DashboardCardNumber title="Online" quantity="1344" icon="mdi-account-group" captionText="En tiempo real" color="#18aa5e"></DashboardCardNumber>
5+
<DashboardCardNumber title="Usuarios Online" quantity="1344" icon="mdi-account-multiple" caption="En tiempo real" color="amber"></DashboardCardNumber>
66
</v-col>
77
<v-col cols="3">
8-
<DashboardCardNumber title="Veedurías" quantity="25" icon="mdi-account-group" captionText="Últimas 24 horas" color="#18aa5e"></DashboardCardNumber>
8+
<DashboardCardNumber title="Veedurías" quantity="25" icon="mdi-shield-account" caption="Últimas 24 horas" color="blue"></DashboardCardNumber>
99
</v-col>
1010
<v-col cols="3">
11-
<DashboardCardNumber title="Patrocinios" quantity="87" icon="mdi-account-group" captionText="Últimas 24 horas" color="#18aa5e"></DashboardCardNumber>
11+
<DashboardCardNumber title="Patrocinios" quantity="87" icon="mdi-charity" caption="Últimas 24 horas" color="pink"></DashboardCardNumber>
1212
</v-col>
1313
<v-col cols="3">
14-
<DashboardCardNumber title="Transacciones" quantity="106" icon="mdi-account-group" captionText="Últimas 24 horas" color="#18aa5e"></DashboardCardNumber>
14+
<DashboardCardNumber title="Transacciones" quantity="106" icon="mdi-cash-multiple" caption="Últimas 24 horas" color="green"></DashboardCardNumber>
1515
</v-col>
1616
</v-row>
17-
<v-row>
17+
<v-row class="mt-9 mb-2">
1818
<v-col cols="6">
19-
<DashboardUserRegistrations></DashboardUserRegistrations>
19+
<DashboardSparkline color="grey darken-1" title="Usuarios Registrados" caption="último registro hace 7 minutos"
20+
:labels="['6h', '7h', '8h', '9h', '10h', '11h', '12h', '13h', '14h', '15h', '16h', '17h', '18h']"
21+
:values="[100, 200, 300, 700, 400, 600, 1000, 1300, 1200, 900, 900, 900, 100]"></DashboardSparkline>
22+
</v-col>
23+
<v-col cols="6">
24+
<DashboardSparkline color="grey darken-1" title="Proyectos Creados" caption="última creación hace 1 minuto"
25+
:labels="['6h', '7h', '8h', '9h', '10h', '11h', '12h', '13h', '14h', '15h', '16h', '17h', '18h']"
26+
:values="[5, 2, 7, 17, 4, 6, 10, 13, 2, 5, 9, 3, 18]"></DashboardSparkline>
2027
</v-col>
2128
</v-row>
2229
</v-container>
2330
</template>
2431

2532
<script>
26-
import DashboardUserRegistrations from '@/components/DashboardUserRegistrations.vue'
33+
import DashboardSparkline from '@/components/DashboardSparkline.vue'
2734
import DashboardCardNumber from '@/components/DashboardCardNumber.vue'
2835
2936
export default {
3037
name: 'Dashboard',
3138
3239
components: {
33-
DashboardUserRegistrations,
40+
DashboardSparkline,
3441
DashboardCardNumber
3542
},
3643

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13474,6 +13474,11 @@ vue-loader@^15.9.2:
1347413474
vue-hot-reload-api "^2.3.0"
1347513475
vue-style-loader "^4.1.0"
1347613476

13477+
vue-resize-text@^0.1.1:
13478+
version "0.1.1"
13479+
resolved "https://registry.yarnpkg.com/vue-resize-text/-/vue-resize-text-0.1.1.tgz#b3143c086d412ca181c2b2abd0153bc22742d11b"
13480+
integrity sha512-teQjTzJpwYdBKG2hOc7lA6U3hUNuew3nROuPLPRzX1wxSgG/tQ+YNOHobxXxuIKf36zFTs68y2Y0JY1zx7fZrg==
13481+
1347713482
vue-router@^3.2.0:
1347813483
version "3.5.1"
1347913484
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.5.1.tgz#edf3cf4907952d1e0583e079237220c5ff6eb6c9"

0 commit comments

Comments
 (0)