ActionView components for Shopify's Polaris components: https://polaris.shopify.com/
This gem is under active development. It is indeed as a drop-in solution for adding Polaris components to Ruby on Rails Shopify apps.
Add this line to your application's Gemfile:
gem 'polaris-html', git: 'https://github.com/bravetheskies/Polaris-html'
Add actionview comonents: https://github.com/github/actionview-component
Add this line to your application's Gemfile:
gem "actionview-component"
And then execute:
$ bundle
In config/application.rb
, add:
require "action_view/component/railtie"
textbox = form: , field: , placeholder: nil, help_text: nil, label_hidden: false, class_extra_form_item: ''
<%= render(Form::Text, form: form , field: :email) %>
<%= render(Form::Checkbox, form: form , label: 'Enabled', field: :enabled ) %>
tags - path , label -> defualt to delete path. Need to add as option
<%= render(PolarisLayouts::AnnotatedSection, title: 'Operations', description: 'Past operations showing the alterations made ') do %>
<% end %>
<%= render(PolarisNavigation::FooterHelp) do %>
<% end %>
<%= render(Form::Select.new(form: form, field: :field_name, choices: Example.all.collect {|example| [example.name, example.id]})) %>
You will also need to add some Javascript to your app/javascript/packs/application.js
to change the text in the select box. Example here:
document.addEventListener("turbolinks:load", function() {
const selectboxes = document.querySelectorAll('.Polaris-Select__Input');
selectboxes.forEach((element) => {
element.parentNode.querySelector('.Polaris-Select__SelectedOption').textContent = element.options[element.selectedIndex].text
element.onchange = function(){
element.parentNode.querySelector('.Polaris-Select__SelectedOption').textContent = element.options[element.selectedIndex].text
}
});
});
Original select box javascript:
const selectboxes = document.querySelectorAll('.Polaris-Select__Input');
selectboxes.forEach((element) => {
element.parentNode.querySelector('.Polaris-Select__SelectedOption').textContent = element.value
});
Tags, change to lable and link.
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.