Skip to content
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
15 changes: 15 additions & 0 deletions app/javascript/controllers/textarea_resize_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,19 @@ export default class extends Controller {
this.element.style.height = "auto";
this.element.style.height = `${this.element.scrollHeight + 2}px`;
}

commentResize() {
this.element.style.height = "auto";
this.element.style.height = `${this.element.scrollHeight + 2}px`;
}

resetComment(event) {
if (event.target === this.element.form) {
requestAnimationFrame(() => {
this.element.value = "";
this.element.style.height = "auto";
this.element.style.height = `${this.element.scrollHeight + 2}px`;
});
}
}
}
5 changes: 3 additions & 2 deletions app/views/projects/_project_comments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,12 @@
>
<%= form.text_area :user_comment,
class:
"w-full bg-transparent border-0 text-sm text-gray-800 placeholder-gray-400 py-2 px-2 focus:outline-none resize-none overflow-y-auto max-h-[120px]",
"w-full bg-transparent border-0 text-sm text-gray-800 placeholder-gray-400 py-2 px-2 focus:outline-none resize-none overflow-y-auto max-h-[200px]",
rows: 1,
data: {
controller: "textarea-resize",
action: "input->textarea-resize#resize",
action:
"input->textarea-resize#commentResize turbo:submit-end@window->textarea-resize#resetComment",
},
placeholder: "Write a comment..." %>

Expand Down
12 changes: 9 additions & 3 deletions app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

<section
class="
bg-white rounded-2xl shadow-sm border border-gray-100 flex flex-col h-[600px]
bg-white rounded-2xl shadow-sm border border-gray-100 flex flex-col h-[700px]
max-h-[calc(100vh-200px)]
"
>
Expand Down Expand Up @@ -128,10 +128,16 @@

<%# -- MOBILE-ONLY-PROJECT-ACTION, hidden on xl and up -- %>
<% if policy(@project).update? || @current_version != @latest_version %>
<section class="xl:hidden bg-white rounded-2xl shadow-sm border border-gray-100 p-5 flex-1">
<section
class="
xl:hidden bg-white rounded-2xl shadow-sm border border-gray-100 p-5 flex-1
"
>
<h4
class="
text-xs font-bold text-gray-400 uppercase tracking-wider mb-4 flex items-center gap-2"
text-xs font-bold text-gray-400 uppercase tracking-wider mb-4 flex items-center
gap-2
"
>
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path
stroke-linecap="round"
Expand Down
5 changes: 3 additions & 2 deletions app/views/topics/_topic_comments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,12 @@

<%= form.text_area :user_comment,
class:
"w-full bg-transparent border-0 text-sm text-gray-800 placeholder-gray-400 py-2 px-2 focus:outline-none resize-none overflow-y-auto max-h-[120px]",
"w-full bg-transparent border-0 text-sm text-gray-800 placeholder-gray-400 py-2 px-2 focus:outline-none resize-none overflow-y-auto max-h-[250px]",
rows: 1,
data: {
controller: "textarea-resize",
action: "input->textarea-resize#resize",
action:
"input->textarea-resize#commentResize turbo:submit-end@window->textarea-resize#resetComment",
},
placeholder: "Write a comment..." %>

Expand Down
2 changes: 1 addition & 1 deletion app/views/topics/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<%# --- Comments Section --- %>
<section
class="
bg-white rounded-2xl shadow-sm border border-gray-100 flex flex-col h-[600px]
bg-white rounded-2xl shadow-sm border border-gray-100 flex flex-col h-[700px]
max-h-[calc(100vh-200px)]
"
>
Expand Down
Loading