kuartz-org / vitrail Goto Github PK
View Code? Open in Web Editor NEWKuartz design system view components
Home Page: https://vitrail.kuartz.org
License: MIT License
Kuartz design system view components
Home Page: https://vitrail.kuartz.org
License: MIT License
I find referencing component constant everywhere cumbersome and a bit of lost space, and I'd like to implement a kind of helper I already used on an app of mine.
<div>
<%= render vitrail.title(level: 2).with_content("Hello there!") %>
<%= render vitrail.card(class: "bg-blue-200") do %>
<p>What a nice gem!</p>
<% end %>
</div>
In Vitrail::BaseComponent
, initialize is:
def initialize(**html_options)
super
@custom_classes = html_options.delete(:class) || ""
@html_options = html_options.stringify_keys
end
but by doing so, the html_options
is mutated and key :class
is removed. It could cause unexpected behavior in such examples:
<div>
<% html_options = { class: "text-red-500", data: { some_stimulus_target: "target" } %>
<% @elements.each do |element| %>
<%= render Vitrail::Card.new(**html_options).with_content(element.content) %> <!-- class is not passed after first element-->
<% end %>
</div>
In this case, after the first iteration, hash hold by html_options
variable is mutated and :class
key is remove.
I can see this method comes from Rails codebase but when it is done like, hash is cloned before being mutated.
Edit: I made a PR with a fix #4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.