shared/src/main/scala/purecss/generic/PureAlerts.scala
author Tomas Zeman <tzeman@volny.cz>
Thu, 14 Dec 2017 15:32:50 +0100
changeset 9 ee8565f13df7
parent 8 d1da6ba32afa
child 10 f4bf01584928
permissions -rw-r--r--
Components: form, grid, inputs, table

/*
 * Copyright 2017 Tomas Zeman <tzeman@volny.cz>
 *
 * 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.
 */
package purecss.generic

import scala.language.implicitConversions

trait PureAlerts[B, O <: F, F] extends Component[B, O, F] {
  import bundle.all._

  val pure_alert: C = pc("pure-alert")
  val pure_alert_error: C = pc("pure-alert-error")
  val pure_alert_warning: C = pc("pure-alert-warning")
  val pure_alert_success: C = pc("pure-alert-success")

  implicit def alert2cls(a: Alert): C = a.toCls
  implicit def alert2mod(a: Alert): Modifier = a.toCls.apply()

  sealed abstract class Alert(val secondary: C) {
    def toCls: C = pure_alert & secondary
  }

  object Alert {
    case object Error extends Alert(pure_alert_error)
    case object Warning extends Alert(pure_alert_warning)
    case object Success extends Alert(pure_alert_success)
  }
}