Sha256: 6acd328483f56225dec11866ba6e84d687cc5cac73aab4853082b8121659a4c7

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Phlexi
  module Display
    module Components
      class Url < Base
        include Concerns::DisplaysValue

        def render_value(value)
          a(**attributes, href: value, target: "_blank") {
            icon
            plain value
          }
        end

        protected

        def icon
          icon_theme = themed(:prefixed_icon)
          svg(
            xmlns: "http://www.w3.org/2000/svg",
            width: icon_theme ? nil : "24",
            height: icon_theme ? nil : "24",
            class: icon_theme,
            viewbox: "0 0 24 24",
            fill: "none",
            stroke: "currentColor",
            stroke_width: "2",
            stroke_linecap: "round",
            stroke_linejoin: "round"
          ) do |s|
            s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
            s.path(d: "M9 15l6 -6")
            s.path(d: "M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464")
            s.path(
              d:
                "M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"
            )
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
phlexi-display-0.0.12 lib/phlexi/display/components/url.rb
phlexi-display-0.0.11 lib/phlexi/display/components/url.rb
phlexi-display-0.0.10 lib/phlexi/display/components/url.rb
phlexi-display-0.0.9 lib/phlexi/display/components/url.rb
phlexi-display-0.0.8 lib/phlexi/display/components/url.rb