summaryrefslogtreecommitdiff
path: root/_sass/common/components/_menu.scss
blob: 222676a518a2d50b8320fa88dfbd0f9006120fc9 (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
@mixin menu-direction($direction: default) {
  @if $direction == default {
    $direction: "horizontal";
  }
  @if $direction == "vertical" {
    @include flex-direction(column);
  } @else {
    @include flex-direction(row);
  }
}

@mixin menu($horizontal-spacer: default, $horizontal-item-vertical-spacer: default, $wrap: default) {
  @if $horizontal-spacer == default {
    $horizontal-spacer: map-get($menu, horizontal-spacer);
  }
  @if $horizontal-item-vertical-spacer == default {
    $horizontal-item-vertical-spacer: map-get($menu, horizontal-item-vertical-spacer);
  }
  @if $wrap == default {
    $wrap: wrap;
  }
  @include flexbox();
  @include flex-wrap($wrap);
  margin-top: 0;
  margin-bottom: 0;
  & > li {
    @if $horizontal-item-vertical-spacer {
      margin-top: map-get($spacers, $horizontal-item-vertical-spacer);
      margin-bottom: map-get($spacers, $horizontal-item-vertical-spacer);
    }
    margin-right: map-get($spacers, $horizontal-spacer);
    list-style-type: none;
    &:last-child {
      margin-right: 0;
    }
  }
}

.menu {
  @include menu();
  @include menu-direction();
  @include align-items(center);
}

.menu--vertical {
  @include menu-direction("vertical");
  @include align-items(normal);
  & > li {
    margin-right: 0;
  }
}

.menu--inline {
  @include inline-flex();
}

.menu--center {
  @include justify-content(center);
}

.menu--nowrap {
  @include flex-wrap(nowrap);
}

.menu--grow {
  @include flex-grow(1);
}