-
Notifications
You must be signed in to change notification settings - Fork 33
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 #136 from SpeciesFileGroup/development
Development
- Loading branch information
Showing
8 changed files
with
165 additions
and
18 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
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
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,77 @@ | ||
<template> | ||
<div class="overflow-hidden h-[550px] w-full"> | ||
<img | ||
class="object-cover overflow-hidden h-[550px] w-full absolute" | ||
:key="currentDepiction.src" | ||
:src="currentDepiction.src" | ||
alt="Dichroplus maculipennis" | ||
/> | ||
<div class="bg-black bg-opacity-25 absolute h-full w-full top-0"></div> | ||
<div class="absolute bottom-2 right-4"> | ||
<span class="z-10 text-white text-sm drop-shadow"> | ||
<RouterLink | ||
v-if="currentDepiction.otuId" | ||
class="text-white" | ||
:to="{ name: 'otus-id', params: { id: currentDepiction.otuId } }" | ||
> | ||
{{ currentDepiction.label }} © {{ currentDepiction.copyright }} | ||
</RouterLink> | ||
</span> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { onMounted, ref, computed, onBeforeUnmount } from 'vue' | ||
import { makeAPIRequest } from '@/utils' | ||
const props = defineProps({ | ||
depictionId: { | ||
type: Array, | ||
default: () => [] | ||
}, | ||
interval: { | ||
type: Number, | ||
default: 5000 | ||
} | ||
}) | ||
const depictions = ref([]) | ||
const currentIndex = ref(0) | ||
const currentDepiction = computed(() => depictions[currentIndex.value] || {}) | ||
let timeout = null | ||
function updateIndex() { | ||
currentIndex.value = Math.round(Math.random() * depictions.length) | ||
} | ||
onMounted(() => { | ||
makeAPIRequest.get(`/url`).then(({ data }) => { | ||
depictions.value = data | ||
timeout = setInterval(updateIndex, props.interval) | ||
}) | ||
}) | ||
onBeforeUnmount(() => { | ||
clearInterval(timeout) | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.fade-enter-active, | ||
.fade-leave-active { | ||
transition: opacity 1s ease-in-out; | ||
} | ||
.fade-enter-from { | ||
opacity: 0; | ||
} | ||
.fade-enter-to { | ||
opacity: 1; | ||
} | ||
.fade-enter, | ||
.fade-leave-to { | ||
opacity: 0; | ||
} | ||
</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
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,35 @@ | ||
<template> | ||
<component | ||
:is="tag" | ||
:class="layoutClasses" | ||
> | ||
<slot /> | ||
</component> | ||
</template> | ||
|
||
<script setup> | ||
import { computed } from 'vue' | ||
const props = defineProps({ | ||
tag: { | ||
type: String, | ||
default: 'div' | ||
}, | ||
frontmatter: { | ||
type: Object, | ||
required: true | ||
} | ||
}) | ||
const LAYOUT_CLASSES = { | ||
fullwidth: 'p-4 sm:px-0 prose dark:prose-invert max-w-none' | ||
} | ||
const DEFAULT_LAYOUT = | ||
'!container mx-auto p-4 sm:px-0 prose dark:prose-invert box-border' | ||
const layoutClasses = computed( | ||
() => LAYOUT_CLASSES[props.frontmatter.layout] || DEFAULT_LAYOUT | ||
) | ||
</script> |
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
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
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