fix. [SWV-865] 영상재생 버튼 개선

Made-with: Cursor
This commit is contained in:
clkim
2026-02-27 15:14:16 +09:00
parent a21c4127f6
commit 9208aae87f
13 changed files with 81 additions and 32 deletions

View File

@@ -3,7 +3,7 @@ interface props {
type?: 'button' | 'link'
to?: string
target?: '_self' | '_blank'
bgColor?: string
backgroundColor?: string
srOnly?: string
}
@@ -11,7 +11,7 @@ const props = withDefaults(defineProps<props>(), {
type: 'button',
to: '',
target: '_self',
bgColor: '',
backgroundColor: '',
srOnly: '',
})
@@ -34,8 +34,8 @@ const componentProps = computed(() => {
const buttonStyle = computed(() => {
const style: Record<string, string> = {}
if (props.bgColor) {
style.backgroundColor = props.bgColor
if (props.backgroundColor) {
style.backgroundColor = props.backgroundColor
}
return style
})

View File

@@ -2,27 +2,33 @@
import type { TrackingObject } from '#layers/types/api/common'
interface Props {
bgColor?: string
category?: 'system' | 'image'
backgroundColor?: string
tracking: TrackingObject
}
const props = defineProps<Props>()
const props = withDefaults(defineProps<Props>(), { category: 'system' })
const { locale } = useI18n()
const { sendLog } = useAnalytics()
const handlePlayClick = () => {
sendLog(locale.value, props.tracking)
}
const buttonClasses = computed(() => [
'btn-play',
props.category === 'system' ? 'play-icon' : 'play-image',
])
const buttonStyle = computed(() =>
props.category === 'system' && props.backgroundColor
? { backgroundColor: props.backgroundColor }
: {}
)
const onClick = () => sendLog(locale.value, props.tracking)
</script>
<template>
<button
class="btn-play"
:style="{ backgroundColor: props.bgColor }"
@click="handlePlayClick"
>
<span class="icon">
<button :class="buttonClasses" :style="buttonStyle" @click="onClick">
<span v-if="props.category === 'system'" class="icon">
<AtomsIconsArrowRightFill />
</span>
<span class="sr-only">Play</span>
@@ -31,15 +37,35 @@ const handlePlayClick = () => {
<style scoped>
.btn-play {
@apply relative flex items-center justify-center rounded-full w-[60px] h-[60px] md:w-[80px] md:h-[80px]
@apply relative flex items-center justify-center;
}
.play-icon {
@apply w-[60px] h-[60px] md:w-[80px] md:h-[80px] rounded-full
before:content-[''] before:absolute before:top-0 before:left-0 before:w-full before:h-full before:border before:border-[rgba(255,255,255,0.5)] before:rounded-full
after:content-[''] after:absolute after:top-0 after:left-0 after:w-full after:h-full after:bg-white after:rounded-[50%] after:opacity-0 after:transition-opacity after:duration-300 after:ease-in-out
hover:after:opacity-10;
}
.btn-play:hover .icon {
.play-icon:hover .icon {
@apply scale-[1.08];
}
.icon {
@apply transition-transform duration-300 ease-spring;
}
.play-image {
@apply w-[69px] h-[69px] md:w-[110px] md:h-[110px];
}
.play-image::before {
@apply content-[''] absolute inset-0 z-0 bg-no-repeat bg-center bg-cover bg-[url(/images/common/btn_play/btn_default.png)] transition-opacity duration-300 ease-out;
}
.play-image::after {
@apply content-[''] absolute inset-0 z-0 bg-no-repeat bg-center bg-cover bg-[url(/images/common/btn_play/btn_hover.png)] opacity-0 transition-opacity duration-300 ease-out;
}
.play-image:hover::before {
@apply opacity-0;
}
.play-image:hover::after {
@apply opacity-100;
}
</style>