summaryrefslogtreecommitdiffstats
path: root/apps/web-shared/src/styles/components/responsive-sidebar.scss
blob: 29a45f4b307b874666d9386f33466eb9b0f6fc2f (plain) (blame)
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
@use '../base' as *;

/* -------------------------------- 
File#: _1_responsive-sidebar
Title: Responsive Sidebar
Descr: Responsive sidebar container
Usage: codyhouse.co/license
-------------------------------- */

$maxwidth: 250px;

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-index-fixed-element, 10);
  width: 100%;
  height: 100%;
  visibility: hidden;

  &::after { /* overlay layer */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: alpha(var(--color-black), 0);
    z-index: 1;
  }

  @include breakpoint(sm) {
    visibility: visible;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: $maxwidth;
    border-right: var(--border-width, 1px) var(--border-style, solid) hsla(var(--color-contrast-lower-h), var(--color-contrast-lower-s), var(--color-contrast-lower-l), var(--border-o, 1));

    .sidebar__header {
      display: none;
    }

    .sidebar__panel {
      position: relative !important;
    }
  }

  .sidebar__panel {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background-color: var(--color-bg);
  }

  &.sidebar--right-on-mobile {
    .sidebar__panel {
      left: auto;
      right: 0;
      transform: translateX(100%);
    }
  }

  &.sidebar--is-visible {
    visibility: visible;

    &::after {
      background-color: alpha(var(--color-black), 0.55);
    }

    .sidebar__panel {
      transform: translateX(0);
      box-shadow: var(--shadow-md);
    }
  }
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
}

.sidebar__close-btn {
  --size: 32px;
  width: var(--size);
  height: var(--size);
  display: flex;
  border-radius: 50%;
  background-color: var(--color-bg-light);
  box-shadow: var(--inner-glow), var(--shadow-sm);
  flex-shrink: 0;

  .icon {
    display: block;
    margin: auto;
  }

  &:hover {
    background-color: var(--color-bg-lighter);
    box-shadow: var(--inner-glow), var(--shadow-md);
  }
}