ํŽญ์†”๋‹˜ ๐Ÿง๐Ÿง๐Ÿง๐Ÿง๐Ÿง๐Ÿง ( ์•„์ง ๋ชป ๋ณด์‹  ๊ฒƒ ๊ฐ™๊ธธ๋ž˜ ์ž„ํ‹ฐ๋กœ ์‹œ์„ ์„ ๋Œ์–ด๋ดค์Šต๋‹ˆ๋‹ค. ์—„.. ์ฃ„์†กํ•ฉ๋‹ˆ๋‹ค. )

์„ค์ •
2025-06-27 19:02โ€ข์กฐํšŒ 84โ€ข๋Œ“๊ธ€ 7โ€ข์ต
์•„๋ž˜ ๊ฑธ๋กœ ๋งŒ๋“ค์–ด์ฃผ์‹ค ์ˆ˜ ์žˆ๋‚˜์š”

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>๊ฒŒ์‹œํŒ ์‚ฌ์ดํŠธ</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}

header {
background-color: #333;
color: white;
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}

header h1 {
margin: 0;
font-size: 20px;
}

#addPostBtn {
font-size: 24px;
cursor: pointer;
background: none;
border: none;
color: white;
}

.board-container {
display: flex;
flex-wrap: wrap;
padding: 10px;
}

.section {
flex: 1 1 300px;
border: 1px solid #ccc;
margin: 10px;
padding: 10px;
}

.section h2 {
margin-top: 0;
}

.post {
border-top: 1px solid #ddd;
padding: 5px 0;
}

/* Modal ์Šคํƒ€์ผ */
.modal {
display: none;
position: fixed;
z-index: 10;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}

.modal-content {
background-color: #fefefe;
margin: 10% auto;
padding: 20px;
border: 1px solid #888;
width: 300px;
}

.modal-content select, .modal-content input, .modal-content textarea {
width: 100%;
margin: 10px 0;
padding: 5px;
}

.modal-content button {
padding: 8px 16px;
margin-top: 10px;
background-color: #333;
color: white;
border: none;
cursor: pointer;
}

</style>
</head>
<body>

<header>
<h1>๋‚˜์˜ ๊ฒŒ์‹œํŒ</h1>
<button id="addPostBtn">๏ผ‹</button>
</header>

<div class="board-container">
<div class="section" id="free">
<h2>์ž์œ  ๊ฒŒ์‹œํŒ</h2>
<div class="posts"></div>
</div>
<div class="section" id="share">
<h2>๋‚˜๋ˆ” ๊ฒŒ์‹œํŒ</h2>
<div class="posts"></div>
</div>
<div class="section" id="talk">
<h2>์†Œํ†ต ๊ฒŒ์‹œํŒ</h2>
<div class="posts"></div>
</div>
<div class="section" id="promo">
<h2>ํ™๋ณด ๊ฒŒ์‹œํŒ</h2>
<div class="posts"></div>
</div>
<div class="section" id="etc">
<h2>๊ธฐํƒ€ ๊ฒŒ์‹œํŒ</h2>
<div class="posts"></div>
</div>
</div>

<!-- ๊ฒŒ์‹œ๊ธ€ ์ถ”๊ฐ€ ๋ชจ๋‹ฌ -->
<div id="postModal" class="modal">
<div class="modal-content">
<h3>๊ฒŒ์‹œ๋ฌผ ์ถ”๊ฐ€</h3>
<select id="sectionSelect">
<option value="">์„น์…˜ ์„ ํƒ</option>
<option value="free">์ž์œ  ๊ฒŒ์‹œํŒ</option>
<option value="share">๋‚˜๋ˆ” ๊ฒŒ์‹œํŒ</option>
<option value="talk">์†Œํ†ต ๊ฒŒ์‹œํŒ</option>
<option value="promo">ํ™๋ณด ๊ฒŒ์‹œํŒ</option>
<option value="etc">๊ธฐํƒ€ ๊ฒŒ์‹œํŒ</option>
</select>
<input type="text" id="postTitle" placeholder="์ œ๋ชฉ ์ž…๋ ฅ">
<textarea id="postContent" placeholder="๋‚ด์šฉ ์ž…๋ ฅ" rows="4"></textarea>
<button id="submitPost">์™„๋ฃŒ</button>
</div>
</div>

<script>
const addPostBtn = document.getElementById('addPostBtn');
const modal = document.getElementById('postModal');
const submitPost = document.getElementById('submitPost');

addPostBtn.onclick = () => {
modal.style.display = 'block';
};

// ๋ชจ๋‹ฌ ์™ธ ํด๋ฆญ ์‹œ ๋‹ซ๊ธฐ
window.onclick = function(event) {
if (event.target === modal) {
modal.style.display = "none";
}
};

submitPost.onclick = () => {
const section = document.getElementById('sectionSelect').value;
const title = document.getElementById('postTitle').value;
const content = document.getElementById('postContent').value;

if (!section) {
alert('์„น์…˜์„ ์„ ํƒํ•ด ์ฃผ์„ธ์š”.');
return;
}

const postHTML = `
<div class="post">
<strong>${title}</strong><br>
<p>${content}</p>
</div>
`;
document.querySelector(`#${section} .posts`).innerHTML += postHTML;

// ์ดˆ๊ธฐํ™” ๋ฐ ๋ชจ๋‹ฌ ๋‹ซ๊ธฐ
document.getElementById('sectionSelect').value = '';
document.getElementById('postTitle').value = '';
document.getElementById('postContent').value = '';
modal.style.display = 'none';
};
</script>

</body>
</html>
๋Œ“๊ธ€
๋“ฑ๋ก๋œ ๋Œ“๊ธ€์ด ์—†์Šต๋‹ˆ๋‹ค.