<template>
  <div class="titiebox">
    <div
      v-if="label"
      :style="{ width: width }"
      class="titieboxlabel"
    >
      {{ label }} <span
        v-if="needStar"
        style="color: #f00"
      >{{ "*" }}</span>
    </div>
    <div class="titieboxvalue">
      <slot />
    </div>
  </div>
</template>

<script>
export default {
  props: {
    label: {
      type: String,
      default: '',
    },
    needStar: {
      type: Boolean,
      default: false,
    },
    width: {
      type: String,
      default: '150px',
    },
  },
};
</script>

<style lang="scss" scoped>
.titiebox {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  font-size: 12px;
  border-left: 1px solid var(--card-border);
  width: 100%;
  .titieboxlabel {
    border-top: 1px solid var(--card-border);
    padding-left: 8px;
    padding-right: 8px;
    height: 32px;
    line-height: 32px;
    text-align: left;
    background-color: var(--desktop-bg-color-2);
  }
  .titieboxvalue {
    flex: 1;
    box-sizing: border-box;
  }
}
</style>
