
# dependencies
gradients = require "@allenbrowntech/lemon-gradients"
icons = require '@allenbrowntech/lemon-icons'

# template
module.exports = (_) ->

  if _.background
    lg = "linear-gradient(to top, rgba(24,31,54,.8), rgba(24,31,54,0.8))"
    style = "background-image: #{lg}, url('#{_.background}')"
  else if _.gradient
    style = gradients.getCSS _.gradient

  div '#banner', style: style, ->
    div '.content', ->

      if _.intro
        h2 '.intro', ->
          _.intro

      if _.title
        h1 '.title', ->
          _.title
        div '.divider'

      if _.subtitle
        h3 '.subtitle', ->
          _.subtitle

      if _.buttons?.length > 0
        div '.buttons', ->
          for button in _.buttons
            continue if not button
            button.url ?= button.link

            # url and icon
            if button.url? and button.icon?
              div '.button.icon', ->
                a href: button.url, ->
                  raw icons[button.icon]

            # url and text
            else if button.url and button.text
              div '.button.text', ->
                a href: button.url, ->
                  button.text
