-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from johnarban/update-cloud-cover-display
Update cloud cover display
- Loading branch information
Showing
5 changed files
with
271 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<script lang ="ts"> | ||
import { defineComponent } from "vue"; | ||
import { VIcon } from "vuetify/components/VIcon"; | ||
// import { VTooltip } from "vuetify/components/VTooltip"; | ||
export default defineComponent({ | ||
name: 'CloudCover', | ||
components: { | ||
'v-icon':VIcon, | ||
// 'v-tooltip':VTooltip | ||
}, | ||
props: { | ||
cloudCover: { | ||
type: Number || null, | ||
required: true, | ||
default: null | ||
} | ||
}, | ||
computed: { | ||
cloudCoverFracToLabel() { | ||
console.log(this.cloudCover); | ||
if (this.cloudCover !== null) { | ||
return `${(this.cloudCover * 100).toFixed(0)}%`; | ||
} | ||
return 'No data'; | ||
}, | ||
cloudIcon() { | ||
if (this.cloudCover == null) { | ||
return 'mdi-cloud-cancel'; | ||
} | ||
else if (this.cloudCover < .25) { | ||
return 'mdi-weather-sunny'; | ||
} | ||
else if (this.cloudCover < .5) { | ||
return 'mdi-weather-partly-cloudy'; | ||
} | ||
else if (this.cloudCover < 0.9) { | ||
return 'mdi-weather-cloudy'; | ||
} | ||
else { | ||
return 'mdi-clouds'; | ||
} | ||
} | ||
}, | ||
}); | ||
</script> | ||
|
||
|
||
<template> | ||
<div class="cloud-cover-container my-2 py-1"> | ||
<div> | ||
<v-icon size="35">{{ cloudIcon }}</v-icon> | ||
</div> | ||
|
||
<div class="cloud-cover-label"> | ||
<div class="cloud-cover-label-text"> Median historical<br>cloud cover: </div> | ||
<div class="cloud-cover-label-value">{{ cloudCoverFracToLabel }}</div> | ||
</div> | ||
|
||
</div> | ||
|
||
|
||
</template> | ||
|
||
|
||
<style> | ||
.cloud-cover-container { | ||
display: flex; | ||
height: 100%; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
outline: 1px solid var(--accent-color); | ||
} | ||
.cloud-cover-label { | ||
display: flex; | ||
align-items: center; | ||
padding-left: 10px; | ||
} | ||
.cloud-cover-label-text { | ||
font-size: calc(1.1 * var(--default-font-size)); | ||
font-weight: normal; | ||
width: 70%; | ||
text-align: center; | ||
} | ||
.cloud-cover-label-value { | ||
font-size: calc(1.5 * var(--default-font-size)); | ||
margin-left: 1rem; | ||
/* no text wrapping */ | ||
white-space: nowrap; | ||
font-weight: bold; | ||
width: 30%; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
|
||
import { tooltip } from 'leaflet'; | ||
<template> | ||
<v-tooltip | ||
width="25ch" | ||
:open-on-click="true" | ||
:open-on-hover="true" | ||
:open-on-focus="true" | ||
> | ||
<template v-slot:activator="{props}" > | ||
<div :class="['define-term-tooltip', inline ? 'inline' : '']" v-bind="props"> | ||
<slot name="term"> | ||
{{ term }} | ||
</slot> | ||
</div> | ||
</template> | ||
|
||
<div class="define-term-tooltip definition" v-html="definition"> | ||
</div> | ||
|
||
</v-tooltip> | ||
</template> | ||
|
||
|
||
<script lang="ts"> | ||
import { defineComponent } from "vue"; | ||
import { VTooltip } from "vuetify/components/VTooltip"; | ||
export default defineComponent({ | ||
name: 'DefineTerm', | ||
components: { | ||
'v-tooltip': VTooltip, | ||
}, | ||
props: { | ||
term: { | ||
type: String, | ||
required: true | ||
}, | ||
definition: { | ||
type: String, | ||
required: true | ||
}, | ||
inline: { | ||
type: Boolean, | ||
default: true | ||
} | ||
} | ||
}); | ||
</script> | ||
|
||
<style> | ||
.v-tooltip > .v-overlay__content { | ||
background: #F5F5F5 !important; | ||
} | ||
.define-term-tooltip.inline { | ||
display: inline; | ||
pointer-events: auto; | ||
font-weight: bold; | ||
} | ||
.define-term-tooltip.definition { | ||
font-size: var(--default-font-size); | ||
color: black; | ||
padding-block: 0.5em; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.