-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from pierry01/jean/add-textarea
ADD TEXTAREA
- Loading branch information
Showing
7 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# frozen_string_literal: true | ||
|
||
class Docs::TextareaView < ApplicationView | ||
def view_template | ||
component = "Textarea" | ||
|
||
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do | ||
render Docs::Header.new(title: "Textarea", description: "Displays a textarea field.") | ||
|
||
TypographyH2 { "Usage" } | ||
|
||
render Docs::VisualCodeExample.new(title: "Textarea", context: self) do | ||
<<~RUBY | ||
div(class: "grid w-full max-w-sm items-center gap-1.5") do | ||
Textarea(placeholder: "Textarea") | ||
end | ||
RUBY | ||
end | ||
|
||
render Docs::VisualCodeExample.new(title: "Disabled", context: self) do | ||
<<~RUBY | ||
div(class: "grid w-full max-w-sm items-center gap-1.5") do | ||
Textarea(disabled: true, placeholder: "Disabled") | ||
end | ||
RUBY | ||
end | ||
|
||
render Docs::VisualCodeExample.new(title: "With FormField", context: self) do | ||
<<~RUBY | ||
div(class: "grid w-full max-w-sm items-center gap-1.5") do | ||
FormField do | ||
FormFieldLabel(for: "textarea") { "Textarea" } | ||
FormFieldHint { "This is a textarea" } | ||
Textarea(placeholder: "Textarea", id: "textarea") | ||
FormFieldError() | ||
end | ||
end | ||
RUBY | ||
end | ||
end | ||
|
||
render Docs::ComponentsTable.new(component_references(component, Docs::VisualCodeExample.collected_code), component_files(component)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module RBUI | ||
class TextareaPreview < Lookbook::Preview | ||
# Default | ||
# --------------- | ||
def default | ||
render(TestView.new) do | ||
Textarea(placeholder: "Textarea") | ||
end | ||
end | ||
|
||
# Disabled | ||
def disabled | ||
render(TestView.new) do | ||
Textarea(disabled: true, placeholder: "Disabled") | ||
end | ||
end | ||
|
||
# FormField | ||
def with_error | ||
render(TestView.new) do | ||
FormField do | ||
FormFieldLabel(for: "textarea") { "Textarea" } | ||
FormFieldHint { "This is a textarea" } | ||
Textarea(placeholder: "Textarea", id: "textarea") | ||
FormFieldError { "This is an error message" } | ||
end | ||
end | ||
end | ||
end | ||
end |