<template>
    <div>
        <JqxRibbon ref="myRibbon"
            :width="getWidth" :height="335" :position="'right'"
            :selectionMode="'hover'" :animationType="'fade'">
            <ul id="header" style="width: 115px;">
                <li>TV and Players</li>
                <li>Cell phones</li>
                <li>Cameras</li>
                <li>Computers</li>
            </ul>
            <div>
                <div>
                    <div class="container">
                        <table>
                            <tr>
                                <td class="list">
                                    <b><a href="#">TV</a></b>
                                </td>
                            </tr>
                            <tr></tr>
                            <tr>
                                <td class="list">
                                    <a href="#">LED</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">LCD</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">Plasma</a>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <hr />
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <b><a href="#">PLAYERS</a></b>
                                </td>
                            </tr>
                            <tr></tr>
                            <tr>
                                <td class="list">
                                    <a href="#">DVD</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">Blu-Ray</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">CD</a>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="container">
                        <table>
                            <tr>
                                <td class="promo">
                                    PROMO
                                </td>
                            </tr>
                            <tr>
                                <td class="image">
                                    <img src="../../../images/tv.png" />
                                </td>
                            </tr>
                            <tr>
                                <td class="name">
                                    <a href="#">LG 22MN43D-PZ</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="price">
                                    Price: $1583
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div>
                    <div class="container">
                        <table>
                            <tr>
                                <td class="list">
                                    <b><a href="#">PHONES</a></b>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Brand</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Display size</a>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <hr />
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <b><a href="#">SMARTPHONES</a></b>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Brand</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By OS</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Display size</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By CPU</a>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="container">
                        <table>
                            <tr>
                                <td class="promo">
                                    PROMO
                                </td>
                            </tr>
                            <tr>
                                <td class="image">
                                    <img src="../../../images/Samsung-Galaxy-S4.png" />
                                </td>
                            </tr>
                            <tr>
                                <td class="name">
                                    <a href="#">Samsung I9505 Galaxy S4</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="price">
                                    Price: $569
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div>
                    <div class="container">
                        <table>
                            <tr>
                                <td class="list">
                                    <b>
                                        <a href="#">
                                            DIGITAL<br />
                                            CAMERAS
                                        </a>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">Hybrid</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">Compact</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">Digital SLR</a>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <hr />
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <b><a href="#">CAMCORDERS</a></b>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">FLASH</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">HDD</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">HD Flash</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">HD HDD</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">HD Extreme</a>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="container">
                        <table>
                            <tr>
                                <td class="promo">
                                    PROMO
                                </td>
                            </tr>
                            <tr>
                                <td class="image">
                                    <img src="../../../images/camera.png" />
                                </td>
                            </tr>
                            <tr>
                                <td class="name">
                                    <a href="#">Nikon COOLPIX L330</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="price">
                                    Price: $358
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div>
                    <div class="container">
                        <table>
                            <tr>
                                <td class="list">
                                    <b><a href="#">LAPTOPS</a></b>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Processor Type</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By RAM Capacity</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By HDD Capacity</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Display Size</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Brand</a>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <hr />
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <b><a href="#">DESKTOPS</a></b>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Processor Type</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By RAM Capacity</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By HDD Capacity</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Brand</a>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <hr />
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <b><a href="#">ALL-IN-ONE</a></b>
                                </td>
                            </tr>
                            <tr>
                                <td class="list">
                                    <a href="#">By Brand</a>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="container">
                        <table>
                            <tr>
                                <td class="promo">
                                    PROMO
                                </td>
                            </tr>
                            <tr>
                                <td class="image">
                                    <img src="../../../images/l-25.jpg" style="width: 140px; height: 105px;" />
                                </td>
                            </tr>
                            <tr>
                                <td class="name">
                                    <a href="#">Toshiba Qosmio X70-A-114</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="price">
                                    Price: $2199
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </JqxRibbon>

        <JqxCheckBox style="margin-top: 50px;" @change="change($event)">
            Menu Mode
        </JqxCheckBox>
    </div>
</template>

<script>
    import JqxRibbon from 'jqwidgets-scripts/jqwidgets-vue/vue_jqxribbon.vue';
    import JqxCheckBox from 'jqwidgets-scripts/jqwidgets-vue/vue_jqxcheckbox.vue';

    export default {
        components: {
            JqxRibbon,
            JqxCheckBox
        },
        data: function () {
            return {
                getWidth: '90%'
            }
        },
        methods: {
            change: function (event) {
                const myRibbon = this.$refs.myRibbon;
                const checked = event.args.checked;
                const mode = checked ? 'popup' : 'default';
                const width = checked ? 115 : 425;

                myRibbon.setOptions({ mode: mode });

                if (mode == 'popup') {
                    myRibbon.setPopupLayout(0, 'default', 310, '100%');
                    myRibbon.setPopupLayout(1, 'default', 310, '100%');
                    myRibbon.setPopupLayout(2, 'default', 310, '100%');
                    myRibbon.setPopupLayout(3, 'default', 310, '100%');
                }
            }
        }
    }
</script>

<style>
    a {
        color: inherit;
        text-decoration: none;
    }

    a:hover {
        color: #DC1F26;
    }

    table {
        border-collapse: separate;
        border-spacing: 0px 3px;
        width: 142px;
    }

    .promo, .price {
        height: 25px;
        background-color: #DC1F26;
        color: White;
        text-align: center;
        font-size: 17px;
    }

    .promo {
        font-weight: bold;
        font-family: "Trebuchet MS", Helvetica, sans-serif;
    }

    .price {
        font-family: "Trebuchet MS", Helvetica, sans-serif;
        border: 1px solid pink;
        padding: 5px 5px;
        border-radius: 22px;
    }

    .name {
        height: 35px;
        text-align: center;
        font-style: italic;
    }

    .image {
        height: 220px;
        text-align: center;
    }

    .container {
        width: 140px;
        float: left;
        margin-left: 5px;
    }

    hr {
        width: 75%;
        float: left;
    }
</style>