Skip to content

Instantly share code, notes, and snippets.

@dan-gamble
Created May 18, 2020 21:36
Show Gist options
  • Save dan-gamble/0e6ff9d4bf63c14963ca439f1db1e038 to your computer and use it in GitHub Desktop.
Save dan-gamble/0e6ff9d4bf63c14963ca439f1db1e038 to your computer and use it in GitHub Desktop.
<% accessibility_label = nil if local_assigns[:accessibility_label].nil? %>
<% aria_controls = nil if local_assigns[:aria_controls].nil? %>
<% aria_expanded = nil if local_assigns[:aria_expanded].nil? %>
<% destructive = false if local_assigns[:destructive].nil? %>
<% disabled = false if local_assigns[:disabled].nil? %>
<% disclosure = nil if local_assigns[:disclosure].nil? %>
<% full_width = false if local_assigns[:full_width].nil? %>
<% monochrome = false if local_assigns[:monochrome].nil? %>
<% outline = false if local_assigns[:outline].nil? %>
<% plain = false if local_assigns[:plain].nil? %>
<% pressed = nil if local_assigns[:pressed].nil? %>
<% primary = false if local_assigns[:primary].nil? %>
<% size = 'medium' if local_assigns[:size].nil? %>
<% text_align = 'center' if local_assigns[:text_align].nil? %>
<button
type="button"
class="Polaris-Button<% if destructive %> Polaris-Button--destructive<% end %><% if disabled %> Polaris-Button--disabled<% end %><% if monochrome %> Polaris-Button--monochrome<% end %><% if plain %> Polaris-Button--plain<% end %><% if primary %> Polaris-Button--primary<% end %><% if outline %> Polaris-Button--outline<% end %><% if size == 'slim' %> Polaris-Button--sizeSlim<% elsif size == 'large' %> Polaris-Button--sizeLarge<% end %><% if full_width %> Polaris-Button--fullWidth<% end %><% if text_align == 'left' %> Polaris-Button--textAlignLeft<% elsif text_align == 'right' %> Polaris-Button--textAlignRight<% end %><% if pressed %> Polaris-Button--pressed<% end %>"
<% if accessibility_label.present? %>aria-label="<%= accessibility_label %>"<% end %>
<% if aria_controls.present? %>aria-controls="<%= aria_controls %>"<% end %>
<% if aria_expanded.present? %>aria-expanded="<%= aria_expanded %>"<% end %>
<% unless pressed.nil? %>aria-pressed="<%= pressed %>"<% end %>
<% if disabled %> disabled<% end %>
>
<span class="Polaris-Button__Content">
<span class="Polaris-Button__Text">
<%= yield %>
</span>
<% if disclosure.present? %>
<span class="Polaris-Button__Icon">
<span class="Polaris-Button__DisclosureIcon">
<span class="Polaris-Icon<% if disclosure == 'up' %> Polaris-Button__DisclosureIconFacingUp<% end %>">
<svg viewBox="0 0 20 20" class="Polaris-Icon__Svg" focusable="false" aria-hidden="true">
<path d="M5 8l5 5 5-5z" fill-rule="evenodd"></path>
</svg>
</span>
</span>
</span>
<% end %>
</span>
</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment