mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
* [claudesquad] update from 'component-namespacing' on 18 Jul 25 07:23 EDT * [claudesquad] update from 'component-namespacing' on 18 Jul 25 07:30 EDT * Update stimulus controller references to use namespace * Fix remaining tests
31 lines
682 B
Ruby
31 lines
682 B
Ruby
# An extension to `link_to` helper. All options are passed through to the `link_to` helper with some additional
|
|
# options available.
|
|
class DS::Link < DS::Buttonish
|
|
attr_reader :frame
|
|
|
|
VARIANTS = VARIANTS.reverse_merge(
|
|
default: {
|
|
container_classes: "",
|
|
icon_classes: "fg-gray"
|
|
}
|
|
).freeze
|
|
|
|
def merged_opts
|
|
merged_opts = opts.dup || {}
|
|
data = merged_opts.delete(:data) || {}
|
|
|
|
if frame
|
|
data = data.merge(turbo_frame: frame)
|
|
end
|
|
|
|
merged_opts.merge(
|
|
class: class_names(container_classes, extra_classes),
|
|
data: data
|
|
)
|
|
end
|
|
|
|
private
|
|
def container_size_classes
|
|
super unless variant == :default
|
|
end
|
|
end
|