<template>
    <div class="service">
        <div class="service-img">
            <img :src="info.icon" alt="" />
            <div class="text">{{ info.title }}</div>
        </div>

        <div class="service-hover">
            <div class="name">{{ info.title }}</div>
            <div class="content" v-html="content"></div>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        info: {
            type: Object,
            default: () => {
                return {};
            }
        }
    },
    computed: {
        content() {
            return this.info.content.replace(/\n/g, '<br/>');
        }
    }
};
</script>

<style lang="less" scoped>
.service {
    height: 340px;
    overflow: hidden;
    border-radius: 2px;
    position: relative;
    margin: 10px;
    .service-img {
        box-sizing: border-box;
        background: #fbfbfb;
        border-bottom: 6px solid @prim;
        height: 100%;
        .flex();
        justify-content: center;
        img {
            width: 88px;
            height: 88px;
        }

        .text {
            font-size: 20px;
            font-weight: bold;
            color: #ff8700;
            line-height: 24px;
            margin-left: 28px;
        }
    }

    .service-hover {
        background: #008a69;
        height: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 0 20px;
        transition: top ease-in-out 0.3s;
        .flex-col();

        .name {
            font-size: 20px;
            font-weight: bold;
            color: #ffffff;
            line-height: 24px;
            text-align: center;
            padding: 30px 0 20px;
            border-bottom: 1px solid #fff;
        }

        .content {
            font-size: 14px;
            color: #ffffff;
            line-height: 22px;
            text-align: center;
            padding: 16px 0 16px;
            flex-grow: 1;
            overflow: auto;

            &::-webkit-scrollbar-thumb {
                background: lighten(@warn, 10%);
                border-radius: 10px;
            }

            &::-webkit-scrollbar-thumb:hover {
                background: darken(@warn, 10%);
            }
        }
    }

    &:hover {
        .service-hover {
            top: 0;
        }
    }
}
</style>
