Skip to content

Textareaコンポーネントを追加 #245

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

Merged
merged 1 commit into from
Feb 7, 2025
Merged
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
26 changes: 26 additions & 0 deletions app/views/components/_textarea.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<% if false %>
必要なパラメータ:
なし

オプションパラメータ:
- classes: 追加のCSSクラス
- placeholder: プレースホルダーテキスト
- id: textarea要素のID(form_controlと組み合わせて使用する場合に自動で設定される)
- rows: テキストエリアの行数(デフォルト: 3)
<% end %>

<% classes ||= "" %>
<% placeholder ||= "" %>
<% id ||= nil %>
<% rows ||= 3 %>
<% textarea_classes = [
"border border-[var(--textColor)] rounded-md px-3 py-2 text-[var(--textColor)] focus:outline-none focus:ring-2 focus:ring-blue-500 w-full resize-y",
classes
].join(" ") %>

<textarea
class="<%= textarea_classes %>"
placeholder="<%= placeholder %>"
rows="<%= rows %>"
<%= "id=#{id}" if id.present? %>
></textarea>