Sha256: a21a514876ca0dfb3d23a586ec71c6c85584da16b4984ddff5ae7019d6e746e1
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true module Nexmo module OAS module Renderer module Presenters class ContentSwitcher def initialize(format:, label:, theme_light:, force_type: nil) @format = format @panels = [] @label = label @force_type = force_type @theme_light = theme_light end def add_content(title:, content:, tab_id:, active:) @panels.push({ 'title' => title, 'content' => content, 'x-tab-id' => tab_id, 'active' => active, }) end def render type = 'tabs' type = 'dropdown' if @panels.length >= 8 type = @force_type if @force_type [:"open_api/content_switcher/_#{type}", locals: { panels: @panels, format: @format, label: @label, switcher: self, theme_light: @theme_light, }] end def id @id ||= "s-#{SecureRandom.hex}" end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems