Class: DocsKit::LandingConfig::Logo
- Inherits:
-
Data
- Object
- Data
- DocsKit::LandingConfig::Logo
- Defined in:
- lib/docs_kit/landing_config.rb
Overview
The hero brand logo — either an inline single-path SVG mark (svg = the
<path d> data, viewbox = its viewBox) rendered with fill: currentColor so
it adapts to the theme, OR an image (src = an asset path/URL, alt = its
accessible name). label is the accessible name for the inline mark.
Instance Attribute Summary collapse
-
#alt ⇒ Object
readonly
Returns the value of attribute alt.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
-
#svg ⇒ Object
readonly
Returns the value of attribute svg.
-
#viewbox ⇒ Object
readonly
Returns the value of attribute viewbox.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(svg: nil, viewbox: "0 0 24 24", src: nil, alt: nil, label: nil) ⇒ Logo
constructor
A new instance of Logo.
-
#inline? ⇒ Boolean
An inline SVG mark (vs. an
).
Constructor Details
#initialize(svg: nil, viewbox: "0 0 24 24", src: nil, alt: nil, label: nil) ⇒ Logo
Returns a new instance of Logo.
142 143 144 |
# File 'lib/docs_kit/landing_config.rb', line 142 def initialize(svg: nil, viewbox: "0 0 24 24", src: nil, alt: nil, label: nil) super end |
Instance Attribute Details
#alt ⇒ Object (readonly)
Returns the value of attribute alt
141 142 143 |
# File 'lib/docs_kit/landing_config.rb', line 141 def alt @alt end |
#label ⇒ Object (readonly)
Returns the value of attribute label
141 142 143 |
# File 'lib/docs_kit/landing_config.rb', line 141 def label @label end |
#src ⇒ Object (readonly)
Returns the value of attribute src
141 142 143 |
# File 'lib/docs_kit/landing_config.rb', line 141 def src @src end |
#svg ⇒ Object (readonly)
Returns the value of attribute svg
141 142 143 |
# File 'lib/docs_kit/landing_config.rb', line 141 def svg @svg end |
#viewbox ⇒ Object (readonly)
Returns the value of attribute viewbox
141 142 143 |
# File 'lib/docs_kit/landing_config.rb', line 141 def viewbox @viewbox end |
Class Method Details
.from(logo) ⇒ Object
146 147 148 149 150 151 152 153 154 |
# File 'lib/docs_kit/landing_config.rb', line 146 def self.from(logo) return logo if logo.is_a?(self) attrs = logo.to_h.transform_keys(&:to_sym) new( svg: attrs[:svg], viewbox: attrs[:viewbox] || "0 0 24 24", src: attrs[:src], alt: attrs[:alt], label: attrs[:label] ) end |
Instance Method Details
#inline? ⇒ Boolean
An inline SVG mark (vs. an ). True when
svg path data is present.
157 |
# File 'lib/docs_kit/landing_config.rb', line 157 def inline? = !svg.to_s.empty? |