Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more styling to timeline/posts index #21

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 72 additions & 2 deletions src/main/resources/static/website.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ input[type="reset"] {
background-color: #ADD8E6;
color: black;
padding: 10px 15px;
margin-right: 5px;
border: none;
border-radius: 4px;
cursor: pointer;
Expand Down Expand Up @@ -249,6 +250,15 @@ button:hover {
.profile-with-name {
display: flex;
align-items: center;
text-decoration: none;
color: black;
transition: transform 0.3s;
text-transform: capitalize;
font-weight: 600;
}

.profile-with-name:hover {
color: #ADD8E6;
}

.profile-with-name img {
Expand All @@ -257,7 +267,67 @@ button:hover {
margin-right: 10px;
}

.fa-input {
font-family: FontAwesome, 'Helvetica Neue', Helvetica, Arial, sans-serif;
.comment-like-btns {
display: flex;
flex-direction: row;
justify-content: end;
height: 50px;
}

.posts-timeline {
display: flex;
flex-direction: column;
justify-content: center;
width: 700px;
margin: 0px auto;
list-style: none;
padding-inline-start: 0px;
}

.welcome-title {
display: flex;
justify-content: center;
margin: 15px 0px;
height: 45px;
padding-left: 40px;
font-size: 30px;
}

.posts-content-form {
max-width: 100%;
background-color: #f3f3ec;
padding-left: 40px;
}

.posts-content-form #timeline-form-content {
width: 93%;
padding: 20px;
}

.timeline-posts {
padding-left: 0px;
}

.posts-form-btns {
display: flex;
flex-direction: row;
justify-content: end;
margin-right: 5px;
}

input[type="submit-posts"] {
background-color: #ADD8E6;
color: black;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: transform 0.3s;
}

input[type="submit-posts"]:hover {
background-color: #177b90;
transform: scale(1.08);
color: white;
}

108 changes: 60 additions & 48 deletions src/main/resources/templates/posts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,73 @@
</head>
<body>

<div class="header">
<a th:href="@{/users/{'user_id'}}" class="profile-image">
<div class="header-title" sec:authorize="isAuthenticated()">
<strong>Acebook</strong>
</div>
</a>
<div class="menu-right">
<a href="/posts">Timeline</a>
<a href="/friends">Friends</a>

<!-- Conditional Rendering based on session -->
<div th:if="${session.containsKey('user_id')}">
<form th:action="@{/logout}" method="post">
<input type="submit" value="Sign Out"/>
</form>
</div>
<div th:unless="${session.containsKey('user_id')}">
<a href="/login">Log In</a>
<a href="/register">Register</a>
</div>
<a th:href="@{/users/{'user_id'}}" class="profile-image">
<div class="header">
<a th:href="@{/posts}" class="profile-image">
<div class="header-title" sec:authorize="isAuthenticated()">
<img th:src="@{${profilePicture}}" width="45" height="45" alt="Profile Image">
<strong>Acebook</strong>
</div>
</a>
</div>
</div>
<div class="menu-right">
<a href="/friends">Friends</a>

<a th:href="@{/users/{'user_id'}}" class="profile-image">
<div class="header-title" sec:authorize="isAuthenticated()">
Welcome <span sec:authentication="name" class="header-title-name"></span>!
<!-- Conditional Rendering based on session -->
<div th:if="${session.containsKey('user_id')}">
<form th:action="@{/logout}" method="post">
<input type="submit" value="Sign Out"/>
</form>
</div>
<div th:unless="${session.containsKey('user_id')}">
<a href="/login">Log In</a>
<a href="/register">Register</a>
</div>
<a th:href="@{/users/user.id}" class="profile-image">
<div class="header-title" sec:authorize="isAuthenticated()">
<img th:src="@{${profilePicture}}" width="45" height="45" alt="Profile Image">
</div>
</a>
</div>
</div>
</a>

<form action="#" th:action="@{/posts}" th:object="${newPost}" method="post" class="contentForm">
<textarea type="text" cols="70" rows="10" placeholder="Write a post..." id="content" th:field="*{content}"></textarea>
<div class="posts-timeline">
<div class="welcome-title" sec:authorize="isAuthenticated()">
Welcome<span sec:authentication="name" class="header-title-name"></span>!
</div>

<form action="#" th:action="@{/posts}" th:object="${newPost}" method="post" class="posts-content-form">
<textarea type="text" rows="10" placeholder="Write a post..." id=timeline-form-content th:field="*{content}"></textarea>

<p class="posts-form-btns"><input type="submit" id="submit-posts" value="Submit" /> <input type="reset" value="Reset" /></p>
</form>

<ul th:each="map, stat : ${postsAndPosters}">
<ul th:each="entry : ${map.entrySet()}" class="timeline-posts">
<li class ="user-card-posts">

<div>
<a class="profile-with-name" th:href="@{/users/{id}(id=${entry.getValue().getId()})}" >
<img th:src="${entry.getValue().getImageUrl()}" width="40" height="40" />
<p th:text="${entry.getValue().getUsername()}"></p>
</a>
</div>

<div class="post-content">
<p th:text="${entry.getKey().getContent()}"></p>
</div>

<div class="comment-like-btns">
<form action="#" th:action="@{/post/{id}(id=${entry.getKey().getId()})}" method="get">
<p>
<input type="submit" id="comment" value="Comment" class="btn fa-input" />
<input type="submit" id="like" value="Like"/>
</p>
</form>
</div>

</li>
</ul>
</ul>
</div>

<p><input type="submit" id="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
</form>
<ul th:each="map, stat : ${postsAndPosters}">
<ul th:each="entry : ${map.entrySet()}" class="postContainer">
<li class ="listed">
<p th:text="${entry.getValue().getUsername()}"></p>
<img th:src="${entry.getValue().getImageUrl()}" width="20" height="20" />
<p th:text="${entry.getKey().getContent()}"></p>
<p th:text="${entry.getKey().getTimestamp()}"></p>
<form action="#" th:action="@{/post/{id}(id=${entry.getKey().getId()})}" method="get">
<p>
<input type="submit" id="comment" value="Comment" />
<input type="submit" id="like" value="Like" />
</p>
</form>
</li>
</ul>
</ul>

</body>
</html>
6 changes: 2 additions & 4 deletions src/main/resources/templates/users/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
<body>

<div class="header">
<a th:href="@{/users/{'user_id'}}" class="profile-image">
<a th:href="@{/posts}" class="profile-image">
<div class="header-title" sec:authorize="isAuthenticated()">
<strong>Acebook</strong>
</div>
</a>
<div class="menu-right">
<a href="/posts">Timeline</a>
<a href="/friends">Friends</a>

<!-- Conditional Rendering based on session -->
Expand Down Expand Up @@ -79,10 +78,9 @@ <h3 class="user-posts-header">Posts</h3>

<div class="post-content">
<p th:text="${entry.getKey().getContent()}"></p>
<!-- <p th:text="${entry.getKey().getTimestamp()}"></p>-->
</div>

<div>
<div class="comment-like-btns">
<form action="#" th:action="@{/post/{id}(id=${entry.getKey().getId()})}" method="get">
<p>
<input type="submit" id="comment" value="Comment" class="btn fa-input" />
Expand Down