<template>
<m-trans :enter="enter" :leave="leave">
<div class="monitor-card">
  <div v-if="mode == 1" class="card-wrapper left">
    <div class="card-title">
      {{title}}
      <div class="dot"/>
      <div class="line"/>
    </div>
    <div class="card-content">
      <slot />
    </div>
  </div>
  <div v-else-if="mode == 2" class="card-wrapper right">
    <div class="card-title">
      <div class="line"/>
      <div class="dot"/>
      {{title}}
    </div>
    <div class="card-content">
      <slot />
    </div>
  </div>
</div>
</m-trans>
</template>

<script>
export default {
  name: 'MonitorCard',
  props: {
    title: {
      type: String,
      default: '标题',
    },
    mode: {
      type: [String, Number],
      default: '1',
    },
    enter: {
      type: String,
      default: 'fadeInRight',
    },
    leave: {
      type: String,
      default: 'fadeOutRight',
    }
  }
}
</script>

<style lang="stylus" scoped>
$edgeWidth = 0
$size()
  height 100%
  width 100%

.monitor-card
  $size()
.card-wrapper
  $size()
  background $cardBg
  padding 0.5rem 1rem
  position relative
  &.left
    border-right 0.2rem solid $edgeColor
  &.right
    border-left 0.2rem solid $edgeColor
  .card-title
    display flex
    align-items center
    color $cardFontColor
    font-size 1.4rem
    font-family $font-pang
    .dot
      width 0.4rem
      height 1rem
      background $edgeColor
      margin 0 0.5rem
    .line
      height 1px
      flex 1
      background $edgeColor
      opacity 0.3
  .card-content
    height calc(100% - 2rem)
    overflow-y auto
</style>
