-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feature] #6 - μμ½μ€ν¬ν νλ‘μ, νλ‘μ λͺ©λ‘ ꡬν
- Loading branch information
Showing
1 changed file
with
140 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,148 @@ | ||
<!-- AkoStampFollow.vue --> | ||
<template> | ||
<div> | ||
<h1>Ako Stamp Follow</h1> | ||
<!-- μΆκ°μ μΈ λ΄μ© --> | ||
<div class="min-h-screen bg-[#FFF9F2] font-pretendard flex justify-center"> | ||
<div | ||
class="w-[395px] min-w-[340px] bg-[#FAE8DA] min-h-screen relative overflow-y-auto" | ||
> | ||
<header | ||
class="bg-white shadow-sm py-3 px-4 fixed top-0 left-1/2 transform -translate-x-1/2 w-[395px] min-w-[340px] z-10" | ||
> | ||
<div class="flex items-center justify-between"> | ||
<img src="@/assets/images/Akoming.svg" alt="λ‘κ³ " class="h-8" /> | ||
</div> | ||
</header> | ||
|
||
<main class="flex flex-col px-6 pt-20 pb-24"> | ||
<img | ||
src="@/assets/images/back.svg" | ||
alt="μ΄μ " | ||
style="width: 24px; height: 24px; margin-top: 10px; margin-bottom: 20px; cursor: pointer;" | ||
/> | ||
|
||
<div class="bg-white rounded-2xl mb-4" style="height: 300px; display: flex; justify-content: center;"> | ||
|
||
<div class="follower font-NaL" style="width:50%; display: flex; flex-direction: column; align-items: center; margin-top:10px;"> | ||
<div @click="showFollowers = true; showFollowings = false" style="cursor: pointer;"> | ||
νλ‘μ {{ followerCount }} | ||
</div> | ||
<div class="followerline" :style="{ width: '100%', height: '2px', background: showFollowers ? '#FF7F00' : '#B3B3B3', marginBottom: '15px' }"></div> | ||
<div style="width: 150%; margin-left: 90%; z-index:20;"> | ||
<ul v-show="showFollowers" style="padding: 20; width: 100%;"> | ||
<li v-for="follower in followers" :key="follower.followingId" class="flex justify-between items-center mb-4"> | ||
<span class='font-NaR'>{{ follower.nickname }}</span> | ||
<button @click="blockFollower(follower.followingId)" class="followerDelete-btn">μμ </button> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<div class="following font-NaL" style="width:50%; display: flex; flex-direction: column; align-items: center; margin-top:10px;"> | ||
<div @click="showFollowers = false; showFollowings = true" style="cursor: pointer;"> | ||
νλ‘μ {{ followingCount }} | ||
</div> | ||
<div class="followingline" :style="{ width: '100%', height: '2px', background: showFollowings ? '#FF7F00' : '#B3B3B3', marginBottom: '15px' }"></div> | ||
<div style="width: 100%;"></div> | ||
<ul v-show="showFollowings" style="padding-right: 110%; width: 260%;"> | ||
<li v-for="following in followings" :key="following.followingId" class="flex justify-between items-center mb-4"> | ||
<span class='font-NaR'>{{ following.nickname }}</span> | ||
<button @click="unfollow(following.followingId)" class="unfollow-button">νλ‘μ° μ·¨μ</button> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</main> | ||
<Footer /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
// νμν JavaScript μ½λ | ||
import { ref, onMounted } from 'vue'; | ||
import Footer from '@/components/layout/Footer.vue'; | ||
const followerCount = ref(0); | ||
const followingCount = ref(0); | ||
const followers = ref([]); | ||
const followings = ref([]); | ||
const showFollowers = ref(true); // νλ‘μ 리μ€νΈ 보μ΄κΈ° | ||
const showFollowings = ref(false); // νλ‘μ 리μ€νΈ 보μ΄κΈ° | ||
// νλ‘μ λ° νλ‘μ μ κ°μ Έμ€κΈ° (μμ λ°μ΄ν° μ¬μ©) | ||
function fetchFollowerCount() { | ||
// μμ νλ‘μ λ°μ΄ν° | ||
followers.value = [ | ||
{ followingId: 1, nickname: 'λ―Έλ', email: '[email protected]' }, | ||
{ followingId: 2, nickname: 'ν λ', email: '[email protected]' }, | ||
{ followingId: 3, nickname: 'μνλ', email: '[email protected]' }, | ||
]; | ||
followerCount.value = followers.value.length; | ||
} | ||
function fetchFollowingCount() { | ||
// μμ νλ‘μ λ°μ΄ν° | ||
followings.value = [ | ||
{ followingId: 4, nickname: 'λκ΅μ΄', email: '[email protected]' }, | ||
{ followingId: 5, nickname: 'λ―Έλ', email: '[email protected]' }, | ||
{ followingId: 6, nickname: 'λλμ΄', email: '[email protected]' }, | ||
]; | ||
followingCount.value = followings.value.length; | ||
} | ||
// νλ‘μ μ°¨λ¨ | ||
function blockFollower(id) { | ||
const index = followers.value.findIndex(follower => follower.followingId === id); | ||
if (index !== -1) { | ||
followers.value.splice(index, 1); | ||
followerCount.value--; | ||
} | ||
} | ||
// νλ‘μ° μ·¨μ | ||
function unfollow(id) { | ||
followings.value = followings.value.filter(following => following.followingId !== id); | ||
followingCount.value--; | ||
} | ||
onMounted(() => { | ||
fetchFollowerCount(); | ||
fetchFollowingCount(); | ||
}); | ||
</script> | ||
|
||
<style> | ||
/* μ»΄ν¬λνΈ μ€νμΌ */ | ||
<style scoped> | ||
.unfollow-button { | ||
font-size: 11px; | ||
width: 62px; | ||
height: 24px; | ||
margin-left: 8px; | ||
font-family: 'NaR'; | ||
border-radius: 20px; | ||
color: white; | ||
font-style: normal; | ||
font-weight: 300; | ||
line-height: normal; | ||
background: #FF7F00; | ||
cursor: pointer; | ||
transition: background-color 0.3s; | ||
} | ||
.unfollow-button:hover, | ||
.followerDelete-btn:hover { | ||
background-color: #E0E0E0; | ||
} | ||
.followerDelete-btn { | ||
font-size: 15px; | ||
width: 62px; | ||
height: 24px; | ||
margin-left: 8px; | ||
font-family: 'NaR'; | ||
border-radius: 20px; | ||
color: white; | ||
font-style: normal; | ||
font-weight: 300; | ||
line-height: normal; | ||
background: #FF7F00; | ||
cursor: pointer; | ||
transition: background-color 0.3s; | ||
} | ||
</style> |