Class: DocsUI::Logo
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- DocsUI::Logo
- Includes:
- Phlex::Rails::Helpers::ImageURL
- Defined in:
- app/components/docs_ui/logo.rb
Overview
Renders a DocsKit::BrandLogo (config.brand_logo / config.landing.logo) as the brand mark — an inline currentColor
render DocsUI::Logo.new(config.brand_logo, class: "h-6 w-auto", label: config.brand)
label: is the accessible-name fallback when the logo itself carries none (callers pass config.brand, so the mark always announces the site).
The svg:/paths: forms emit each path-d as an ordinary Phlex-escaped
attribute — config free text never bypasses the escape. The markup:/file:
forms DO embed markup verbatim via raw(safe(...)): that content is the
site's own deliberately-configured SVG (its initializer / its asset file —
the same trust domain as the site's own views, which can already render
anything), not third-party free text, and DocsKit::BrandLogo shape-checks it
to be an
Instance Method Summary collapse
-
#initialize(logo, label: nil, **attributes) ⇒ Logo
constructor
A new instance of Logo.
- #view_template ⇒ Object
Constructor Details
Instance Method Details
#view_template ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/components/docs_ui/logo.rb', line 33 def view_template if @logo.image? img(src: resolved_src, alt: accessible_name.to_s, **@attributes) elsif @logo. else inline_svg end end |