-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<script setup lang="ts"> | ||
import { ref, onMounted } from 'vue'; | ||
import { type Status, type TickerType } from '@/types/types'; | ||
const props = defineProps<{ | ||
tickerData: TickerType[]; | ||
previousData: TickerType[]; | ||
status: Status; | ||
}>(); | ||
const triangleFilter = ref('filterGreen'); | ||
const tickData = props.tickerData; | ||
const prevData = props.previousData; | ||
const prevFilter = triangleFilter.value; | ||
onMounted(() => { | ||
if (prevData.price > tickData.price) { | ||
Check failure on line 18 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
Check failure on line 18 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
Check failure on line 18 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
Check failure on line 18 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
Check failure on line 18 in src/views/Grid.vue GitHub Actions / build (20.x, macos-latest)
Check failure on line 18 in src/views/Grid.vue GitHub Actions / build (20.x, macos-latest)
Check failure on line 18 in src/views/Grid.vue GitHub Actions / build (20.x, macos-latest)
|
||
triangleFilter.value = 'filterRed'; | ||
} else if (prevData.price < tickData.price) { | ||
Check failure on line 20 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
Check failure on line 20 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
Check failure on line 20 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
Check failure on line 20 in src/views/Grid.vue GitHub Actions / build (20.x, macos-latest)
Check failure on line 20 in src/views/Grid.vue GitHub Actions / build (20.x, macos-latest)
|
||
triangleFilter.value = 'filterGreen'; | ||
} else { | ||
triangleFilter.value = prevFilter; | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<header> | ||
<div class="wrapper"> | ||
<div v-if="props.status == 'connecting'" class="info"> | ||
<h1>ETH-USD</h1> | ||
<h1 class="green price">Connecting...</h1> | ||
</div> | ||
<div v-else-if="props.status == 'connected'" class="info"> | ||
<h1>{{ props.tickerData.id }} (Coinbase)</h1> | ||
Check failure on line 36 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
|
||
<div class="value"> | ||
<img src="@/assets/triangle.svg" class="triangle" :class="triangleFilter" /> | ||
<h1 class="green price">${{ props.tickerData.price }}</h1> | ||
Check failure on line 39 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
|
||
</div> | ||
<h1>Volume: ${{ props.tickerData.volume }}</h1> | ||
Check failure on line 41 in src/views/Grid.vue GitHub Actions / build (20.x, ubuntu-20.04)
|
||
</div> | ||
<div v-else class="info"> | ||
<h1>Stock Tracker</h1> | ||
</div> | ||
</div> | ||
</header> | ||
</template> | ||
|
||
<style scoped> | ||
header { | ||
line-height: 1.5; | ||
} | ||
.info { | ||
text-align: center; | ||
} | ||
h1 { | ||
font-weight: 500; | ||
font-size: 2.6rem; | ||
position: relative; | ||
top: -10px; | ||
} | ||
h3 { | ||
font-size: 1.2rem; | ||
} | ||
.value { | ||
display: inline-flex; | ||
align-items: center; | ||
text-align: center; | ||
} | ||
.triangle { | ||
height: 30px; | ||
width: auto; | ||
position: relative; | ||
top: -7px; | ||
} | ||
.price { | ||
vertical-align: middle; | ||
} | ||
@media (min-width: 1024px) { | ||
header { | ||
display: flex; | ||
place-items: center; | ||
} | ||
header .wrapper { | ||
display: flex; | ||
place-items: flex-start; | ||
flex-wrap: wrap; | ||
} | ||
.info { | ||
text-align: left; | ||
} | ||
} | ||
</style> |