Skip to content

Commit e96bd05

Browse files
ui: refactor investment cards
1 parent df6db7e commit e96bd05

File tree

3 files changed

+60
-22
lines changed

3 files changed

+60
-22
lines changed

components/InvestmentResult.vue

+48-20
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,53 @@
11
<template>
2-
<v-card elevation='2' class='mb-2'>
2+
<v-card elevation='2' class='mb-2' max-width='400px'>
33
<v-card-title>{{ name }}</v-card-title>
44
<v-card-text>
5-
<div v-if="hasAmount">Valor Investido: {{ amountDisplay }}</div>
6-
<div v-if='!!interestAmount'>
7-
Rendimento Bruto: {{ interestAmountDisplay }}
8-
</div>
9-
<div v-if='!!iofAmount'>IOF: {{ iofAmountDisplay }}</div>
10-
<div v-if='!!taxAmount'>
11-
Imposto de Renda: {{ taxAmountDisplay }}
12-
<v-badge
13-
inline
14-
v-if='!!taxPercentage'
15-
:content='taxPercentageDisplay'
16-
color='red lighten-2'
17-
/>
18-
</div>
19-
<div>Valor Total Líquido: {{ totalAmountDisplay }}</div>
20-
<v-progress-linear v-model='totalProfitPercentage' :color='color' height='25'>
21-
{{ totalProfitPercentageDisplay }}
22-
</v-progress-linear>
5+
<v-table density="compact">
6+
<tbody>
7+
<tr v-if="hasAmount">
8+
<td class="border-0">Valor Investido</td>
9+
<td class="border-0 text-right">
10+
<code>{{ amountDisplay }}</code>
11+
</td>
12+
</tr>
13+
<tr v-if='!!interestAmount'>
14+
<td class="border-0">Rendimento Bruto</td>
15+
<td class="border-0 text-right">
16+
<code>{{ interestAmountDisplay }}</code>
17+
</td>
18+
</tr>
19+
<tr v-if='!!iofAmount'>
20+
<td class="border-0">IOF</td>
21+
<td class="border-0 text-right">
22+
<code>{{ iofAmountDisplay }}</code>
23+
</td>
24+
</tr>
25+
<tr>
26+
<td class="border-0">Imposto de Renda <v-badge
27+
inline
28+
v-if='!!taxPercentage'
29+
:content='taxPercentageDisplay'
30+
color='red lighten-2'
31+
/></td>
32+
<td class="border-0 text-right">
33+
<code>{{ taxAmountDisplay }}</code>
34+
</td>
35+
</tr>
36+
<tr>
37+
<td class="border-0 border-t-sm">Valor Total Líquido</td>
38+
<td class="border-0 border-t-sm text-right">
39+
<code>{{ totalAmountDisplay }}</code>
40+
</td>
41+
</tr>
42+
<tr>
43+
<td colspan="2">
44+
<v-progress-linear v-model='totalProfitPercentage' :color='color' height='25'>
45+
{{ totalProfitPercentageDisplay }}
46+
</v-progress-linear>
47+
</td>
48+
</tr>
49+
</tbody>
50+
</v-table>
2351
</v-card-text>
2452
</v-card>
2553
</template>
@@ -90,7 +118,7 @@ const totalAmount = computed(() => props.amount + totalProfit.value)
90118
const totalProfitPercentage = computed(() => (totalProfit.value / props.amount) * 100)
91119
92120
const taxPercentageDisplay = computed(() => filters.percent(props.taxPercentage))
93-
const taxAmountDisplay = computed(() => filters.currency(props.taxAmount))
121+
const taxAmountDisplay = computed(() => filters.currency((props.taxAmount ? props.taxAmount * -1 : 0)))
94122
const amountDisplay = computed(() => filters.currency(props.amount))
95123
const iofAmountDisplay = computed(() => filters.currency(props.iofAmount))
96124
const totalAmountDisplay = computed(() => filters.currency(totalAmount.value))

plugins/vuetify.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// import this after install `@mdi/font` package
21
import '@mdi/font/css/materialdesignicons.css'
3-
42
import 'vuetify/styles'
3+
import '../src/styles/custom.css'
54
import { createVuetify } from 'vuetify'
65

76
export default defineNuxtPlugin((app) => {

src/styles/custom.css

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:root .v-table {
2+
line-height: 1.6;
3+
}
4+
5+
:root .v-table--density-compact {
6+
--v-table-row-height: 1rem;
7+
}
8+
9+
:root .v-table > .v-table__wrapper > table > tbody > tr > td {
10+
padding: 0;
11+
}

0 commit comments

Comments
 (0)