<template>
  <div class="module_template">
    <div class="module">
      <div
        v-if="value?.value"
        class="title"
      >{{ value.value }}</div>
      <div
        v-if="value?.children && value?.children.length > 0"
        class="fields"
      >
        <TemplateComponent
          v-for="(child, index) in value.children"
          :key="'module-template-child' + index"
          class="field"
          :value="child"
        />
      </div>
    </div>
  </div>
</template>
<script>
import TemplateComponent from './TemplateComponent.vue';
export default {
  name: 'ModuleTemplate',
  components: {
    TemplateComponent,
  },
  props: {
    value: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {

    };
  },
};
</script>
<style lang="scss" scoped>
.module_template {
  width: 100%;
  position: relative;
  padding: 6px 0 6px 0;
  .module {
    width: 100%;
  }
  .title {
    position: relative;
    margin-left: 16px;
    font-size: 12px;
    line-height: 20px;
    color: var(--application-color-2);
    padding-top: 6px;
    padding-bottom: 6px;
    padding-left: 12px;
    text-align: left;
    &::before {
      position: absolute;
      content: "";
      width: 3px;
      height: 14px;
      border-radius: 1.5px;
      background-color: var(--primary-color-1);
      top: 50%;
      left: 0px;
      transform: translateY(-50%);
    }
  }
  .fields {
    display: flex;
    flex-wrap: wrap;
    padding: 0px 16px 0 16px;
    .field:nth-child(n+1) {
      width: 34%;
    }
    .field:nth-child(2n) {
      flex: 64%;
    }
  }
}
</style>
