aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/stylesheets/scss/css_tree.scss
blob: 278589640559def4ac3acf8b22e52d97004b734b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
$css-tree-distance: 8px;
$css-tree-border: 1px solid var(--light-gray-color-80);

.css-tree {
    &, ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    ul {
        margin-left: $css-tree-distance;
        position: relative;

        &:before {
            border-left: $css-tree-border;
            content: '';
            display: block;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            width: 0;
        }
    }
    li {
        overflow: hidden;
        padding-left: ($css-tree-distance + 2px);
        position: relative;

        &.css-tree-hidden {
            display: none;
        }
    }
    ul li:before {
        content: '';
        display: block;
        height: 0;
        width: $css-tree-distance;
        position: absolute;
        border-top: $css-tree-border;
        left: 0;
        top: $css-tree-distance;
    }
    ul li:last-child:before {
        background: var(--white);
        height: auto;
        top: 10px;
        bottom: 0;
    }
}
.css-tree.collapsable {
    input[type=checkbox] {
        display: none;
        + label {
            @include icon(before, arr_1right, $align: bottom);
            cursor: pointer;

            &:before {
                transition: transform var(--transition-duration);
            }
        }
        ~ ul {
            max-height: 0;
            opacity: 0;

            transition: all var(--transition-duration);
        }
        ~ input[type=radio] + label {
            margin-left: 0;
        }

        &:checked {
            + label::before {
                transform: rotate(90deg);
            }
            ~ ul {
                max-height: 10000px;
                opacity: 1;
            }
        }
    }
}
.css-tree.selectable {
    input[type=checkbox] {
        + label {
            @include hide-text;
        }
        ~ input[type=radio] + label {
            margin-left: 0;
        }
    }

    input[type=radio] {
        display: none;

        + label {
            color: var(--brand-color-dark);
            border-radius: 2px;
            cursor: pointer;
            padding: 0 3px;
            margin-left: 1px;
        }

        &:checked + label {
            font-weight: bold;
            background: var(--content-color-40);
        }

        &[disabled] + label {
            color: var(--dark-gray-color-20);
        }
    }
}