summaryrefslogtreecommitdiffstats
path: root/apps/web-shared/src/styles/components/details.scss
blob: b4c122d94107b45ce97522738c40cbfdd5066747 (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
@use '../base' as *;

/* --------------------------------

File#: _1_details
Title: Details
Descr: A button that toggles the visibility of additional information
Usage: codyhouse.co/license

-------------------------------- */

.details {}

.details__summary {
  display: inline-block;
  cursor: pointer;
  user-select: none;

  &:hover {
    color: var(--color-primary);
  }

  &:focus {
    outline: 2px solid alpha(var(--color-primary), 0.2);
    outline-offset: 4px;
  }

  .icon {
    flex-shrink: 0;
  }
}

// if JS = enabled
.js {
  .details__summary {
    list-style: none; // remove summary default icon
  }

  .details__summary::-webkit-details-marker {
    display: none; // remove default icon in webkit browsers
  }

  .details__summary[aria-expanded="true"] .icon {
    transform: rotate(90deg); // rotate icon when content is visible
  }

  .details__content[aria-hidden="true"] {
    display: none;
  }
}

// if JS = disabled
html:not(.js) .details__summary {
  .icon {
    display: none;
  }
}