1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | $accordion-background: $white !default;
|
12 |
|
13 |
|
14 |
|
15 | $accordion-plusminus: true !default;
|
16 |
|
17 |
|
18 |
|
19 | $accordion-title-font-size: rem-calc(12) !default;
|
20 |
|
21 |
|
22 |
|
23 | $accordion-item-color: $primary-color !default;
|
24 |
|
25 |
|
26 |
|
27 | $accordion-item-background-hover: $light-gray !default;
|
28 |
|
29 |
|
30 |
|
31 | $accordion-item-padding: 1.25rem 1rem !default;
|
32 |
|
33 |
|
34 |
|
35 | $accordion-content-background: $white !default;
|
36 |
|
37 |
|
38 |
|
39 | $accordion-content-border: 1px solid $light-gray !default;
|
40 |
|
41 |
|
42 |
|
43 | $accordion-content-color: $body-font-color !default;
|
44 |
|
45 |
|
46 |
|
47 | $accordion-content-padding: 1rem !default;
|
48 |
|
49 |
|
50 | @mixin accordion-container (
|
51 | $background: $accordion-background
|
52 | ) {
|
53 | margin-#{$global-left}: 0;
|
54 | background: $background;
|
55 | list-style-type: none;
|
56 | &[disabled] {
|
57 | .accordion-title {
|
58 | cursor: not-allowed;
|
59 | }
|
60 | }
|
61 | }
|
62 |
|
63 |
|
64 | @mixin accordion-item {
|
65 | &:first-child > :first-child {
|
66 | border-radius: $global-radius $global-radius 0 0;
|
67 | }
|
68 |
|
69 | &:last-child > :last-child {
|
70 | border-radius: 0 0 $global-radius $global-radius;
|
71 | }
|
72 | }
|
73 |
|
74 |
|
75 | @mixin accordion-title (
|
76 | $padding: $accordion-item-padding,
|
77 | $font-size: $accordion-title-font-size,
|
78 | $color: $accordion-item-color,
|
79 | $border: $accordion-content-border,
|
80 | $background-hover: $accordion-item-background-hover
|
81 | ) {
|
82 | position: relative;
|
83 | display: block;
|
84 | padding: $padding;
|
85 |
|
86 | border: $border;
|
87 | border-bottom: 0;
|
88 |
|
89 | font-size: $font-size;
|
90 | line-height: 1;
|
91 | color: $color;
|
92 |
|
93 | :last-child:not(.is-active) > & {
|
94 | border-bottom: $border;
|
95 | border-radius: 0 0 $global-radius $global-radius;
|
96 | }
|
97 |
|
98 | &:hover,
|
99 | &:focus {
|
100 | background-color: $background-hover;
|
101 | }
|
102 |
|
103 | @if $accordion-plusminus {
|
104 | &::before {
|
105 | position: absolute;
|
106 | top: 50%;
|
107 | #{$global-right}: 1rem;
|
108 | margin-top: -0.5rem;
|
109 | content: '+';
|
110 | }
|
111 |
|
112 | .is-active > &::before {
|
113 | content: '\2013';
|
114 | }
|
115 | }
|
116 | }
|
117 |
|
118 |
|
119 | @mixin accordion-content (
|
120 | $padding: $accordion-content-padding,
|
121 | $border: $accordion-content-border,
|
122 | $background: $accordion-content-background,
|
123 | $color: $accordion-content-color
|
124 | ) {
|
125 | display: none;
|
126 | padding: $padding;
|
127 |
|
128 | border: $border;
|
129 | border-bottom: 0;
|
130 | background-color: $background;
|
131 |
|
132 | color: $color;
|
133 |
|
134 | :last-child > &:last-child {
|
135 | border-bottom: $border;
|
136 | }
|
137 | }
|
138 |
|
139 | @mixin foundation-accordion {
|
140 | .accordion {
|
141 | @include accordion-container;
|
142 | }
|
143 |
|
144 | .accordion-item {
|
145 | @include accordion-item;
|
146 | }
|
147 |
|
148 | .accordion-title {
|
149 | @include accordion-title;
|
150 | }
|
151 |
|
152 | .accordion-content {
|
153 | @include accordion-content;
|
154 | }
|
155 | }
|