# From Modal

Sitenizde bir banner'a veya bir buton'a tıklandığında popup'ta açılan bir form yapısının gösterilmesini sağlayan komponent

## Görünüm

![From Modal](/img/tema/856974699.png)

## Kod Yapısı

Html, Scss ve Json kodlarını kopyalayıp siteniz üzerinde ilgili alana eklediğinizde çalışmasını sağlayabilirsiniz. Kodların kullanımı ile ilgili bilgileri okuyarak nasıl eklemeniz gerektiğini öğrenebilirsiniz.

Test sitemizde Form Modal komponenti kullanılmıştır. [Örneği demo sitede görüntüleyin](https://tema.myideasoft.com/).

### HTML

```twig title="index.html"
{% if theme.settings.form_modal_check %}
    <div class="form-modal">
        <a data-fancybox data-src="#form-modal-content" href="javascript:void(0);">
            <span>{{ theme.settings.form_modal_title }}</span>
            <svg width="24" height="24" viewBox="0 0 24 24" fill="none">
                <path d="M11 19C15.4183 19 19 15.4183 19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19Z" stroke="#777777" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M21 20.9999L16.65 16.6499" stroke="#777777" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M11 8V14" stroke="#777777" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 11H14" stroke="#777777" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
            </svg>
        </a>
    </div>
    <div id="form-modal-content">
        {{ macro_global('dynamicForm', 1) }}
    </div>
{% endif %}
```

Form modal'ın html'inde kullanılan`{{ macro_global('dynamicForm', 1) }}` bu değişkeni admin panelinden **İçerik Yönetimi** / **Form Yönetimi** sayfamızdan, bir form ekledikten sonra oluşan değişken ile değiştirmeniz gerekmektedir. Tek değişen kısmı sadece numarasıdır. Onu yazmanız yeterli olacaktır.

### SCSS

```scss title="style.css"
/* Form Modal */
.form-modal {
    margin-bottom: var(--spacer-9);
    > a {
        display: flex;
        justify-content: space-between;
        color: $color-text;
        font-size: var(--font-size-18);
        padding: var(--spacer-6);
        background-color: #fff;
        border: 1px solid $color-border;
        border-radius: $border-radius;
        &:hover {
            color: $color-primary-lighten;
        }
    }
}

#form-modal-content {
    display: none;
    width: 600px;
    padding: var(--spacer-10) var(--spacer-10) var(--spacer-5);
    @include max($sm) {
        width: 300px;
    }
    .form-group {
        margin-bottom: var(--spacer-5);
        .col-12.col-lg-5,
        .col-12.col-lg-8,
        .col-12.col-lg-9.text-right {
            flex: 1 0 0;
            max-width: none;
        }
        .security-code {
            height: 48px;
        }
        input.form-control {
            height: 48px;
            color: $color-text;
            font-size: var(--font-size-14);
            padding: var(--spacer-2) var(--spacer-4);
        }
        .form-question {
            top: 14px !important;
        }
        .btn {
            height: 48px;
        }
        .btn-group-binary {
            display: flex;
            align-items: center;
            justify-content: space-between;
            &:before,
            &:after {
                display: none;
            }
            > button {
                flex: 0 0 48%;
                max-width: 48%;
                &.mr-2 {
                    margin-right: 0 !important;
                }
            }
        }
    }
}
```

### JSON

```json title="index.js"
"form_modal_check": {
    "type": "checkbox",
    "default_value": "1",
    "label": "Form Modal Durumu"
},
"form_modal_title": {
    "type": "text",
    "default_value": "Form Modal",
    "label": "Form Modal Metni"
}
```
