-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
534 additions
and
245 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
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
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
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,45 @@ | ||
<script setup lang="ts"> | ||
import { ref } from "vue"; | ||
import { useElementSize, useToggle } from "@vueuse/core"; | ||
import ActionButton from "./ActionButton.vue"; | ||
defineProps<{ | ||
/** Maximum height (px). */ | ||
maxHeight: number; | ||
}>(); | ||
const el = ref(null); | ||
const { height } = useElementSize(el); | ||
const [expanded, toggleExpanded] = useToggle(); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<!-- Outer wrapper, whose height gets limited --> | ||
<div | ||
:class="{ mask: !expanded && height > maxHeight }" | ||
:style="{ | ||
// Set max height to slightly less than requested, to avoid ridiculously small differences between closed and expanded heights. | ||
maxHeight: !expanded ? maxHeight - 50 + 'px' : undefined, | ||
}" | ||
> | ||
<!-- Inner wrapper, of which height is measured (content's intrinsic height) --> | ||
<div ref="el"> | ||
<slot /> | ||
</div> | ||
</div> | ||
|
||
<div v-if="height > maxHeight" class="text-center p-2 text-sm"> | ||
<ActionButton class="button-slim" @click="toggleExpanded()"> | ||
<icon :icon="expanded ? 'angles-up' : 'angles-down'" /> | ||
{{ expanded ? $t("expand.close") : $t("expand.open") }} | ||
</ActionButton> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.mask { | ||
mask-image: linear-gradient(to top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 4em); | ||
} | ||
</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.