/*-
 * #%L
 * Badge List Add-on
 * %%
 * Copyright (C) 2023 - 2024 Flowing Code
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package com.flowingcode.vaadin.addons.badgelist;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Text;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.dom.Element;
import com.vaadin.flow.dom.ElementFactory;

/** Base class for demo views. */
@SuppressWarnings("serial")
public class BaseBadgeListDemo extends Div {

  public BaseBadgeListDemo() {
    setClassName("badge-list-main");
  }

  protected Div createContainerDiv(String title, Component component) {
    Div containerDiv = createContainerDiv();
    Span titleSpan = new Span(new Text(title));
    titleSpan.addClassName("title-span");
    containerDiv.add(titleSpan, component);
    return containerDiv;
  }

  private Div createContainerDiv() {
    Div containerDiv = new Div();
    containerDiv.setClassName("badge-list-container");
    return containerDiv;
  }

  protected void addSeparator() {
    Element hr = ElementFactory.createHr();
    this.getElement().appendChild(hr);
  }
}
