Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanisha0708 authored Nov 11, 2024
1 parent 15f1977 commit 90c2c0f
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 23 deletions.
56 changes: 33 additions & 23 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,45 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Social Media Platform</title>
<link rel="stylesheet" href="styles.css">
<title>Social Media Management System</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Login Page -->
<div id="login-container">
<h2>Login</h2>
<form id="login-form">
<input type="text" id="username" placeholder="Username" required>
<input type="password" id="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
</div>
<div class="container">
<div id="login-container">
<h2>Login to Social Media Management</h2>
<form id="loginForm">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>

<label for="password">Password:</label>
<input type="password" id="password" name="password" required>

<label for="email">Email:</label>
<input type="email" id="email" name="email" required>

<label for="bio">Bio:</label>
<textarea id="bio" name="bio" placeholder="Tell us about yourself..."></textarea>

<!-- Main Feed Page -->
<div id="main-feed" style="display: none;">
<header>
<h1>Welcome to SocialHub</h1>
<button id="logout-btn">Logout</button>
</header>
<div id="post-form">
<textarea id="post-content" placeholder="What's on your mind?"></textarea>
<button onclick="createPost()">Post</button>
<button type="submit">Login</button>
</form>
</div>
<div id="feed">
<!-- User posts will appear here -->

<div id="welcome-container" style="display: none;">
<h2>Welcome to Our Social Media Management System!</h2>
<p id="userMessage"></p>
<button id="viewAccountBtn">View Account</button>
</div>
</div>

<div id="account-container" style="display: none;">
<h2>Your Account</h2>
<p><strong>Username:</strong> <span id="accountUsername"></span></p>
<p><strong>Email:</strong> <span id="accountEmail"></span></p>
<p><strong>Bio:</strong> <span id="accountBio"></span></p>
<button id="logoutBtn">Logout</button>
</div>
</div>

<script src="script.js"></script>
</body>
</html>
31 changes: 31 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
document.getElementById('loginForm').addEventListener('submit', function(event) {
event.preventDefault();

const username = document.getElementById('username').value;
const email = document.getElementById('email').value;
const bio = document.getElementById('bio').value;

// Hide login form and show welcome message
document.getElementById('login-container').style.display = 'none';
document.getElementById('welcome-container').style.display = 'block';

// Display a welcome message with the username
document.getElementById('userMessage').innerText = `Welcome, ${username}!`;

// Store user details for the account view
document.getElementById('accountUsername').innerText = username;
document.getElementById('accountEmail').innerText = email;
document.getElementById('accountBio').innerText = bio;
});

document.getElementById('viewAccountBtn').addEventListener('click', function() {
document.getElementById('welcome-container').style.display = 'none';
document.getElementById('account-container').style.display = 'block';
});

document.getElementById('logoutBtn').addEventListener('click', function() {
// Reset to initial view
document.getElementById('account-container').style.display = 'none';
document.getElementById('login-container').style.display = 'block';
document.getElementById('loginForm').reset();
});
57 changes: 57 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
body {
font-family: Arial, sans-serif;
background-color: #f0f2f5;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.container {
width: 400px;
padding: 20px;
background: #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
border-radius: 8px;
text-align: center;
}

h2 {
color: #333;
}

form {
display: flex;
flex-direction: column;
}

label {
margin: 10px 0 5px;
text-align: left;
color: #555;
}

input, textarea {
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}

button {
padding: 10px;
background-color: #007bff;
border: none;
color: #fff;
border-radius: 4px;
cursor: pointer;
}

button:hover {
background-color: #0056b3;
}

#account-container, #welcome-container {
margin-top: 20px;
}

0 comments on commit 90c2c0f

Please sign in to comment.