fix. [SWV-826] TOP 버튼 배경 컬러 관리
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { TrackingObject } from '#layers/types/api/common'
|
||||
import type { ColorObject, TrackingObject } from '#layers/types/api/common'
|
||||
|
||||
interface Props {
|
||||
color: ColorObject
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const { locale } = useI18n()
|
||||
const { y: windowY } = useWindowScroll({ behavior: 'smooth' })
|
||||
@@ -12,6 +18,9 @@ const analytics = {
|
||||
} as TrackingObject
|
||||
|
||||
const showBtn = computed(() => windowY.value > 0)
|
||||
const backgroundColor = computed(() =>
|
||||
getColorCodeFromData(props.color, 'none')
|
||||
)
|
||||
|
||||
const handleScrollToTop = () => {
|
||||
windowY.value = 0
|
||||
@@ -25,6 +34,7 @@ const handleScrollToTop = () => {
|
||||
v-show="showBtn"
|
||||
class="btn-top"
|
||||
sr-only="top"
|
||||
:style="{ backgroundColor: backgroundColor }"
|
||||
@click="handleScrollToTop"
|
||||
>
|
||||
<AtomsIconsArrowControlTopLine />
|
||||
@@ -39,4 +49,7 @@ const handleScrollToTop = () => {
|
||||
.btn-top:hover :deep(.icon) {
|
||||
@apply -translate-y-[3px];
|
||||
}
|
||||
.btn-top:hover :deep(.icon svg) {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user