app/views/lookbook/components/_param.html.erb in lookbook-0.4.8 vs app/views/lookbook/components/_param.html.erb in lookbook-0.5.0.beta.0
- old
+ new
@@ -1,19 +1,23 @@
+<%
+value = params.key?(param[:name]) ? params[param[:name]] : param[:default]
+%>
<div
+ id="<%= @example.id %>-param-<%= param[:name] %>-input"
class="px-4 py-3"
- x-data="param"
- <% if i == 0 %>x-effect="if ($store.inspector.panels.active === 'params') setFocus()"<% end %>
+ x-data="param('<%= param[:name] %>', <%= value.to_json %>)"
+ <% if i == 0 %>x-effect="if ($store.inspector.drawer.active === 'params') setFocus()"<% end %>
>
<div class="flex items-start max-w-[800px]">
- <div class="w-[200px] flex-none py-2">
+ <div class="flex-none py-2" :style="`width: ${horizontal ? '200' : '120' }px`">
<label for="param-<%= param[:name] %>" class="font-bold">
<%= param[:name].titleize %>
</label>
</div>
<div class="flex-grow">
<%= render "lookbook/inputs/#{param[:input]}",
**param,
- value: params.key?(param[:name]) ? params[param[:name]] : param[:default],
+ value: value,
id: "#{@example.id}-param-#{param[:name]}-input"
%>
</div>
</div>
</div>
\ No newline at end of file