diff --git a/app/assets/stylesheets/components/form.css b/app/assets/stylesheets/components/form.css index 5bff0c355..3895f6780 100644 --- a/app/assets/stylesheets/components/form.css +++ b/app/assets/stylesheets/components/form.css @@ -36,4 +36,12 @@ .auth-login-links { @apply flex items-center justify-center gap-4 text-center border-t border-solid text-gray border-light_gray; } + + /* Formula field */ + .formula{ + border-radius: inherit !important; + border-color: #6b7280 !important; + overflow: hidden; + resize: none !important; + } } diff --git a/app/javascript/controllers/textarea_controller.js b/app/javascript/controllers/textarea_controller.js new file mode 100644 index 000000000..33e25e146 --- /dev/null +++ b/app/javascript/controllers/textarea_controller.js @@ -0,0 +1,18 @@ +import { Controller } from "@hotwired/stimulus"; + +export default class extends Controller { + static targets = ["textarea"]; + + connect() { + this.resize(this.element); + } + + resize(textarea) { + textarea.style.height = "auto"; + textarea.style.height = `${textarea.scrollHeight}px`; // Adjust height based on scrollHeight + } + + input(event) { + this.resize(event.target); + } +} diff --git a/app/views/account/calculators/partials/_formula_fields.html.erb b/app/views/account/calculators/partials/_formula_fields.html.erb index ce40536f6..bee217020 100644 --- a/app/views/account/calculators/partials/_formula_fields.html.erb +++ b/app/views/account/calculators/partials/_formula_fields.html.erb @@ -3,7 +3,9 @@