Sha256: 07493c71e7ae62b2c75d1b5822767e0569ae61d4f227d2419ca0fd8b588247c2

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

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

        def render_value(value)
          a(**attributes, href: "mailto:#{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:
                "M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"
            )
            s.path(d: "M3 7l9 6l9 -6")
          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/email.rb
phlexi-display-0.0.11 lib/phlexi/display/components/email.rb
phlexi-display-0.0.10 lib/phlexi/display/components/email.rb
phlexi-display-0.0.9 lib/phlexi/display/components/email.rb
phlexi-display-0.0.8 lib/phlexi/display/components/email.rb