Skip to content
Snippets Groups Projects
bar-chart.scss 2.53 KiB

@use 'styles/settings.scss' as s;

.bar-chart-container {
    height: 180px;
    width: 100%;
    padding: 50px;
    background: s.$background-white;
    border-radius: 10px;

    .error-screen {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .bar-chart {
        display: flex;
        justify-content: space-evenly;
        align-items: flex-end;
        margin-top: -15px;
        height: calc(100% + 15px);
        position: relative;

        &:before,
        &:after {
            content: ' ';
            position: absolute;
            bottom: 0;
            left: 0;
            height: 24px;
            background: s.$background-light;
            width: 100%;
            z-index: 0;
            border-radius: 5px;
        }

        &:after {
            bottom: 48px;
        }

        .tooltip {
            position: absolute;
            top: -8px;
            left: 50%;
            transform: translate(-50%, -75%);
            padding: 10px;
            background: s.$white;
            color: s.$black;
            border-radius: 5px;
            display: block;
            visibility: hidden;
            opacity: 0;
            box-shadow: 0 0 10px rgba(s.$black, 0.15);

            &:before {
                content: ' ';
                position: absolute;
                bottom: 0;
                width: 0;
                height: 0;
                left: 50%;
                transform: translate(-50%, 100%);
                border-width: 8px 8px 0 8px;
                border-color: s.$white transparent transparent transparent;
                border-style: solid;
            }
        }

        .bar {
            background: s.$linear-gradient;
            width: 24px;
            z-index: 1;
            position: relative;
            border-top-left-radius: 5px;
            border-top-right-radius: 5px;
            transition-property: width, height;

            &:hover {
                opacity: 0.9;
                z-index: 20000;

                .tooltip {
                    transform: translate(-50%, -100%);
                    opacity: 1;
                    visibility: visible;
                }
            }

            .label {
                position: absolute;
                bottom: -5px;
                font-size: 14px;
                font-weight: s.$weight-semi-bold;
                text-transform: uppercase;
                left: 50%;
                transform: translate(-50%, 100%);
            }
        }
    }
}