Skip to content
Open
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
67 changes: 67 additions & 0 deletions demo/app/previews/button_component_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,71 @@ def external

def with_tooltip
end

# @label Playground
# @param button_label text "Button label"
# @param url url "Button URL"
# @param icon_name text "Polaris icon name"
# @param tooltip text "Tooltip text"
# @param size select "Button size" {{Polaris::HeadlessButton::SIZE_OPTIONS}}
# @param text_align select "Text alignment" {{Polaris::HeadlessButton::TEXT_ALIGN_OPTIONS}}
# @param disclosure select "Disclosure icon" {{Polaris::HeadlessButton::DISCLOSURE_OPTIONS}}
# @param primary toggle "Primary style"
# @param destructive toggle "Destructive style"
# @param plain toggle "Plain style"
# @param outline toggle "Outline style"
# @param monochrome toggle "Monochrome style"
# @param pressed toggle "Pressed state"
# @param full_width toggle "Full width"
# @param external toggle "Open in new tab"
# @param submit toggle "Submit button type"
# @param disabled toggle "Disable the button"
# @param loading toggle "Show loading spinner"
# @param disable_with_loader toggle "Disable on click with loader"
# @param remove_underline toggle "Remove underline (plain + monochrome)"
def playground(
button_label: "Add product",
url: "https://shopify.com",
icon_name: "PlusCircleIcon",
tooltip: "Add product",
size: Polaris::HeadlessButton::SIZE_DEFAULT,
text_align: Polaris::HeadlessButton::TEXT_ALIGN_DEFAULT,
disclosure: Polaris::HeadlessButton::DISCLOSURE_DEFAULT,
primary: false,
destructive: false,
plain: false,
outline: false,
monochrome: false,
pressed: false,
full_width: false,
external: false,
submit: false,
disabled: false,
loading: false,
disable_with_loader: false,
remove_underline: false
)
render_with_template(locals: {
button_label: button_label,
url: url,
icon_name: icon_name,
tooltip: tooltip,
size: size,
text_align: text_align,
disclosure: disclosure,
primary: primary,
destructive: destructive,
plain: plain,
outline: outline,
monochrome: monochrome,
pressed: pressed,
full_width: full_width,
external: external,
submit: submit,
disabled: disabled,
loading: loading,
disable_with_loader: disable_with_loader,
remove_underline: remove_underline,
})
end
end
21 changes: 21 additions & 0 deletions demo/app/previews/button_component_preview/playground.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<%= polaris_button(
url: url,
icon_name: icon_name,
tooltip: tooltip,
size: size,
text_align: text_align,
disclosure: disclosure,
primary: primary,
destructive: destructive,
plain: plain,
outline: outline,
monochrome: monochrome,
pressed: pressed,
full_width: full_width,
external: external,
submit: submit,
disabled: disabled,
loading: loading,
disable_with_loader: disable_with_loader,
remove_underline: remove_underline
) { button_label } %>