Skip to content

Commit

Permalink
Adjusted comment form styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekaterina-Vititneva committed Oct 9, 2024
1 parent 589757e commit 3b6aa38
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 88 deletions.
203 changes: 121 additions & 82 deletions project_2/commerce/auctions/static/auctions/styles.css
Original file line number Diff line number Diff line change
@@ -1,169 +1,208 @@
body {
padding: 10px;
padding: 10px;
}

.form-control {
margin-bottom: 0.25rem;
margin-bottom: 0.25rem;
}

.btn-primary {
background-color: #007bff;
border-color: #007bff;
background-color: #007bff;
border-color: #007bff;
}

.btn-primary:hover {
background-color: #0056b3;
border-color: #004085;
background-color: #0056b3;
border-color: #004085;
}

.btn-submit {
margin-top: 1rem;
margin-top: 1rem;
}

.listings-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 16px;
padding: 16px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 16px;
padding: 16px;
}

.text-body-secondary {
font-size: 14px;
color: #696969;
font-size: 14px;
color: #696969;
}

.card {
margin: 12px;
border-radius: 8px;
color: black;
text-decoration: none !important;
margin: 12px;
border-radius: 8px;
color: black;
text-decoration: none !important;
}

.card-price {
display: flex;
flex-direction: row;
display: flex;
flex-direction: row;
}

.card-subtitle-bold {
font-weight: bold;
font-weight: bold;
}

.card-statuse {
margin-left: auto;
margin-left: auto;
}

.text-bg-success {
background-color: #9ab7f4 !important;
background-color: #9ab7f4 !important;
}

.text-bg-danger {
background-color: #e0ac8b !important;
background-color: #e0ac8b !important;
}

.card:hover {
text-decoration: none;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
text-decoration: none;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.listing-image {
border-radius: 8px 8px 0px 0px;
width: 100%;
object-fit: cover;
object-position: center;
border-radius: 8px 8px 0px 0px;
width: 100%;
object-fit: cover;
object-position: center;
}

.listing-card-link:hover {
text-decoration: none;
text-decoration: none;
}

.listing {
display: flex;
flex-direction: column;
gap: 16px;
display: flex;
flex-direction: column;
gap: 16px;
}

.listing-image-single {
width: 500px;
object-fit: cover;
object-position: center;
width: 500px;
object-fit: cover;
object-position: center;
}

.card-text {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.5em;
height: 4.5em;
max-height: 4.5em;
padding-bottom: 1px;
word-wrap: break-word;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.5em;
height: 4.5em;
max-height: 4.5em;
padding-bottom: 1px;
word-wrap: break-word;
}

.listing-description-heading {
font-weight: bold;
font-weight: bold;
}

.listing-top {
display: flex;
flex-direction: row;
gap: 16px;
display: flex;
flex-direction: row;
gap: 16px;
}

.bid {
display: flex;
flex-direction: column;
gap: 16px;
display: flex;
flex-direction: column;
gap: 16px;
}

.listing-details{
display: flex;
flex-direction: column;
gap: 16px;
.listing-details {
display: flex;
flex-direction: column;
gap: 16px;
}

.card-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: bold;
}

.placeholder-rectangle {
height: 200px;
width: 100%;
background-color: #ececec;
border-radius: 8px 8px 0 0;
height: 200px;
width: 100%;
background-color: #ececec;
border-radius: 8px 8px 0 0;
}

.placeholder-rectangle-listing {
height: 400px;
width: 500px;
background-color: #ececec;
height: 400px;
width: 500px;
background-color: #ececec;
}

.bid-form {
width: 400px;
width: 400px;
}

.custom-alert {
font-size: 14px;
width: 400px;
height: 40px;
padding: 8px 15px;
line-height: 1.2;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-bottom: 10px;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
width: 400px;
height: 40px;
padding: 8px 15px;
line-height: 1.2;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-bottom: 10px;
display: flex;
align-items: center;
justify-content: space-between;
}

.badge {
opacity: 85%;
opacity: 85%;
}

/* Add margins and padding to form elements */
.form-control {
margin-bottom: 1rem;
padding: 10px;
font-size: 14px;
}

.card {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
border: 1px solid #ececec;
margin-bottom: 15px;
border-radius: 5px;
}

.card-body {
padding: 15px;
}

.card-header {
font-weight: bold;
background-color: #f8f9fa;
padding: 10px;
border-bottom: 1px solid #ececec;
border-radius: 5px 5px 0 0;
}

.btn-primary {
background-color: #007bff;
border-color: #007bff;
}

.btn-primary:hover {
background-color: #0056b3;
border-color: #004085;
}

/* Add some margin to the comment submit button */
.btn-primary {
margin-top: 10px;
}
17 changes: 11 additions & 6 deletions project_2/commerce/auctions/templates/auctions/listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ <h4 class="listing-bid">{{ listing.bid }}€</h4>
<div class="comments">
<p class="listing-description-heading">Comments</p>
{% if user.is_authenticated %}
<div class="card">
<form action="{% url 'listing' listing.title %}" method="post">
{% csrf_token %} {{ comment_form.as_p }}
<input type="hidden" name="form_type" value="comment_form" />
<button type="submit" class="btn btn-primary">Add Comment</button>
</form>
<div class="card mt-3">
<div class="card-body">
<form action="{% url 'listing' listing.title %}" method="post">
{% csrf_token %}
<div class="mb-3">
{{ comment_form.comment }}
<!-- This will render the comment field as a textarea -->
</div>
<button type="submit" class="btn btn-primary">Add Comment</button>
</form>
</div>
</div>

{% endif %} {% for comment in comments %}
Expand Down

0 comments on commit 3b6aa38

Please sign in to comment.