fix. [SWV-798] ​​​​​​​GNB SNS 버튼 직관성 및 시인성 향상

This commit is contained in:
clkim
2026-03-11 16:45:25 +09:00
parent 532b9b6855
commit e11b92f230
27 changed files with 110 additions and 129 deletions

View File

@@ -1,167 +1,151 @@
<script setup lang="ts"> <script setup lang="ts">
import type { TrackingObject, ColorObject } from '#layers/types/api/common' const SNS_KEY_ORDER = [
'kakao',
const showSnsList = ref(false) 'twitter',
'discord',
'youtube',
'instagram',
'facebook',
'tiktok',
] as const
const SNS_KEY_RANK: Record<string, number> = Object.fromEntries(
SNS_KEY_ORDER.map((key, index) => [key, index])
)
const SNS_DISPLAY_LIMIT = 3
const { locale, tm } = useI18n() const { locale, tm } = useI18n()
const gameDataStore = useGameDataStore() const gameDataStore = useGameDataStore()
const modalStore = useModalStore() const modalStore = useModalStore()
const { sendLog } = useAnalytics() const { sendLog } = useAnalytics()
const { gameData, snsJson } = storeToRefs(gameDataStore) const { snsJson } = storeToRefs(gameDataStore)
const { handleOpenToast } = modalStore const { handleOpenToast } = modalStore
const analytics = { const analytics = {
action_type: 'click', action_type: 'click',
click_sarea: 'SNS', click_sarea: 'SNS',
} as TrackingObject }
const snsBackgroundColor = computed(() => { const isExpanded = ref(true)
const colorData = gameData.value?.comm_sns_bg_color_json
?.display as ColorObject const hasSnsData = computed(() => Object.keys(snsJson.value).length > 0)
const colorCode = getColorCodeFromData(colorData, 'none') const enabledSnsKeys = computed(() => {
return colorCode const keys = Object.keys(snsJson.value).filter(
key => snsJson.value[key].use_yn === 1 && snsJson.value[key].url
)
return keys.sort((a, b) => {
const aRank = SNS_KEY_RANK[a] ?? Number.POSITIVE_INFINITY
const bRank = SNS_KEY_RANK[b] ?? Number.POSITIVE_INFINITY
return aRank - bRank
})
})
const isMoreThanThree = computed(
() => enabledSnsKeys.value.length > SNS_DISPLAY_LIMIT
)
const getSnsButtonStyle = (key: string) => ({
'--bg-default': `url(${formatPathHost(`/images/common/btn_sns/sns-${key}_default.png`, { imageType: 'public' })})`,
'--bg-active': `url(${formatPathHost(`/images/common/btn_sns/sns-${key}_active.png`, { imageType: 'public' })})`,
}) })
const handleControlForce = (state: boolean) => { const handleSnsSendLog = (clickItem: string) => {
showSnsList.value = state sendLog(locale.value, { ...analytics, click_item: clickItem })
} }
const handleCopy = async () => { const handleCopy = async () => {
if (!import.meta.client) return if (!import.meta.client) return
try { try {
const url = window.location.href await navigator.clipboard.writeText(window.location.href)
await navigator.clipboard.writeText(url)
handleOpenToast({ contentText: tm('Alert_Copy_Complete') }) handleOpenToast({ contentText: tm('Alert_Copy_Complete') })
sendLog(locale.value, { ...analytics, click_item: 'URL복사' }) sendLog(locale.value, { ...analytics, click_item: 'URL복사' })
} catch (error) { } catch {
console.error('[handleCopy] Error:', error) // clipboard API 실패 시 무시 (e.g. 보안 컨텍스트, 권한)
} }
} }
const handleControlForce = () => {
isExpanded.value = !isExpanded.value
}
</script> </script>
<template> <template>
<div v-if="Object.keys(snsJson).length > 0" class="sns-wrap"> <div v-if="hasSnsData" class="sns-wrap">
<transition name="fade"> <div :class="['sns-list', { 'is-expanded': isExpanded }]">
<AtomsButtonCircle <a
v-show="!showSnsList" v-for="key in enabledSnsKeys"
:background-color="snsBackgroundColor" :key="key"
sr-only="sns" :href="snsJson[key].url"
class="btn-more" target="_blank"
@click="handleControlForce(true)" :class="`btn-sns ${key}`"
:style="getSnsButtonStyle(key)"
@click="handleSnsSendLog(key)"
> >
<AtomsIconsShareLine class="icon-share" /> <span class="sr-only">{{ key }}</span>
</AtomsButtonCircle> </a>
</transition> <button
<transition name="fade"> type="button"
<div v-show="showSnsList" class="sns-list"> sr-only="copy"
<template v-for="(item, key) in snsJson" :key="key"> class="btn-sns community"
<AtomsButtonCircle :style="getSnsButtonStyle('community')"
v-if="item.use_yn === 1 && item.url" @click="handleCopy"
type="external" >
:href="item.url" <span class="sr-only">copy</span>
:sr-only="key" </button>
:class="['btn-sns', key]" </div>
@click="sendLog(locale, { ...analytics, click_item: key })" <AtomsButtonCircle
> v-if="isMoreThanThree"
<img :sr-only="isExpanded ? 'Collapse SNS links' : 'Expand SNS links'"
width="100%" class="btn-control"
height="100%" :class="{ 'is-expanded': isExpanded }"
:src=" @click="handleControlForce"
formatPathHost(`/images/common/ic-v2-logo-${key}-fill.png`, { >
imageType: 'public', <AtomsIconsArrowRightLine color="rgba(255,255,255,0.7)" />
}) </AtomsButtonCircle>
"
:alt="key"
/>
</AtomsButtonCircle>
</template>
<AtomsButtonCircle
type="action"
sr-only="copy"
class="btn-sns link"
@click="handleCopy"
>
<img
width="100%"
height="100%"
:src="
formatPathHost('/images/common/ic-v2-community-link-line.png', {
imageType: 'public',
})
"
alt="copy"
/>
</AtomsButtonCircle>
<div class="close-container">
<button
type="button"
class="opacity-50 z-[1] hover:opacity-100"
@click="handleControlForce(false)"
>
<span class="sr-only">close</span>
<AtomsIconsCloseLine size="24" />
</button>
</div>
</div>
</transition>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.sns-wrap { .sns-wrap {
@apply fixed bottom-3 left-3 h-[40px] md:bottom-8 md:left-8 md:h-[48px] z-[100]; @apply fixed bottom-3 left-3 flex gap-1.5 h-[40px] z-[100] sm:bottom-5 sm:left-5 md:bottom-8 md:left-8 md:h-[48px] md:gap-2;
}
.btn-more:hover .icon-share {
@apply fill-white;
}
.btn-sns {
@apply bg-center bg-no-repeat bg-[rgba(255,255,255,0.6)] after:hidden;
}
.btn-sns.kakao:hover {
@apply bg-[#FAE100];
}
.btn-sns.kakao:hover img {
filter: brightness(0) saturate(100%) invert(13%) sepia(2%) saturate(0%)
hue-rotate(0deg) brightness(100%) contrast(100%);
}
.btn-sns.tiktok:hover {
@apply bg-[#000];
}
.btn-sns.discord:hover {
@apply bg-[#000];
}
.btn-sns.twitter:hover {
@apply bg-[#000];
}
.btn-sns.youtube:hover {
@apply bg-[#FF0000];
}
.btn-sns.facebook:hover {
@apply bg-[#1977F2];
}
.btn-sns.instagram:hover {
@apply bg-[#000];
}
.btn-sns.link:hover {
@apply bg-[#000];
} }
.sns-list { .sns-list {
@apply absolute bottom-0 left-0 flex items-center justify-center gap-4 rounded-full h-full pl-4 pr-3; @apply overflow-hidden relative flex items-center gap-1.5 rounded-full max-w-[110px] p-2.5 md:gap-2 md:p-3 md:max-w-[136px] transition-[max-width] duration-300
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.06)] before:rounded-full;
} }
.sns-item {
@apply w-[24px] h-[24px] bg-center bg-cover bg-no-repeat opacity-50 z-[1] .sns-list.is-expanded {
hover:opacity-100; @apply max-w-[1000px];
} }
.sns-item:hover {
.btn-sns {
@apply relative flex items-center justify-center shrink-0 rounded-full w-[26px] h-[26px] bg-center bg-no-repeat bg-contain
md:w-8 md:h-8;
background-image: var(--bg-default);
}
.btn-sns::after {
@apply content-[''] absolute inset-0 rounded-full bg-center bg-no-repeat bg-contain opacity-0 pointer-events-none transition-opacity duration-300;
background-image: var(--bg-active);
}
.btn-sns:hover::after {
@apply opacity-100; @apply opacity-100;
} }
.close-container { .btn-control.is-expanded {
@apply relative flex pl-4 @apply rotate-180;
before:content-[''] before:absolute before:top-1/2 before:left-0 before:w-[1px] before:h-[20px] before:bg-[rgba(255,255,255,0.1)] before:translate-y-[-50%]; }
.btn-control:hover :deep(.icon) {
@apply translate-x-[3px];
}
[data-theme='dark'] .sns-list,
[data-theme='dark'] .btn-control {
@apply bg-[rgba(0,0,0,0.2)] backdrop-blur-[15px];
}
[data-theme='light'] .sns-list,
[data-theme='light'] .btn-control {
@apply bg-[rgba(255,255,255,0.1)] backdrop-blur-[15px];
} }
</style> </style>

View File

@@ -114,7 +114,7 @@ onMounted(async () => {
@apply mt-[var(--scroll-position,48px)]; @apply mt-[var(--scroll-position,48px)];
} }
.sns-wrap ~ .navigation-wrap { .sns-wrap ~ .navigation-wrap {
@apply pb-[78px]; @apply pb-[60px] md:pb-[80px];
} }
.navigation-wrap { .navigation-wrap {
@@ -146,7 +146,7 @@ onMounted(async () => {
} }
.navigation-wrap.is-closed { .navigation-wrap.is-closed {
@apply translate-x-[calc(-100%+20px)] sm:translate-x-[calc(-100%+40px)]; @apply translate-x-[calc(-100%+12px)] sm:translate-x-[calc(-100%+20px)] md:translate-x-[calc(-100%+32px)];
} }
.navigation-wrap.is-closed .btn-control { .navigation-wrap.is-closed .btn-control {
@apply rotate-0; @apply rotate-0;

View File

@@ -29,9 +29,6 @@ export interface GameDataValue {
design_theme: number design_theme: number
lang_codes: string[] lang_codes: string[]
key_color_json: GameDataKeyColors key_color_json: GameDataKeyColors
comm_sns_bg_color_json: {
display: ColorObject
}
comm_multilang_filename?: string comm_multilang_filename?: string
footer_dev_ci_img_yn: boolean footer_dev_ci_img_yn: boolean
footer_dev_ci_img_path: string footer_dev_ci_img_path: string

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 B