Skip to content

Commit c23ddcc

Browse files
Replace SVG chevron in disclosure widget with CSS shape
Maintains visual consistency
1 parent 342a482 commit c23ddcc

File tree

4 files changed

+35
-19
lines changed

4 files changed

+35
-19
lines changed

assets-src/styles/sass/60-advanced-components/_disclosure-widget.scss

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,22 @@
1515
[data-toggle="true"] {
1616
@include txt-pluto;
1717
align-items: center;
18+
display: inline-flex;
1819
font-weight: bold;
1920

20-
svg {
21-
pointer-events: none;
22-
}
21+
// Decorative chevron
22+
&::after {
23+
block-size: rem(7);
24+
border-color: black;
25+
border-style: solid;
26+
border-width: 0 rem(2) rem(2) 0;
27+
content: "";
28+
inline-size: rem(7);
29+
margin-block-start: rem(-3);
30+
margin-inline-end: rem(3);
31+
margin-inline-start: rem(12);
32+
transform: rotate(45deg);
33+
}
2334

2435
&:hover {
2536
box-shadow: 0 0 4px 2px rgba(84,84,84,0.25);
@@ -33,19 +44,16 @@
3344
}
3445

3546
[data-toggle="true"][aria-expanded="false"] {
36-
.angle-up {
37-
display: none;
38-
}
39-
4047
+ * {
4148
display: none;
4249
}
4350
}
4451

4552
[data-toggle="true"][aria-expanded="true"] {
46-
.angle-down {
47-
display: none;
48-
}
53+
&::after {
54+
margin-block-start: rem(4);
55+
scale: -1;
56+
}
4957

5058
+ * {
5159
display: block;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<button type="button" class="button button--ghost with-icon with-icon--after" style="display:none;" data-toggle="true">Toggle content <svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 320 512" class="icon" focusable="false" aria-hidden="true" width="1em" height="1em"><path class="angle-down" d="M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"/><path class="angle-up" d="M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"/></svg></button>
1+
<button type="button" class="button button--ghost" style="display:none;" data-toggle="true">Toggle content</button>

public/dist/assets/styles/advanced.css

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,20 @@ br {
856856
font-size: 0.9375rem;
857857
line-height: 1.5;
858858
align-items: center;
859+
display: inline-flex;
859860
font-weight: bold;
860861
}
861-
[data-toggle=true] svg {
862-
pointer-events: none;
862+
[data-toggle=true]::after {
863+
block-size: 0.4375rem;
864+
border-color: black;
865+
border-style: solid;
866+
border-width: 0 0.125rem 0.125rem 0;
867+
content: "";
868+
inline-size: 0.4375rem;
869+
margin-block-start: -0.1875rem;
870+
margin-inline-end: 0.1875rem;
871+
margin-inline-start: 0.75rem;
872+
transform: rotate(45deg);
863873
}
864874
[data-toggle=true]:hover {
865875
box-shadow: 0 0 4px 2px rgba(84, 84, 84, 0.25);
@@ -870,15 +880,13 @@ br {
870880
box-shadow: none;
871881
}
872882

873-
[data-toggle=true][aria-expanded=false] .angle-up {
874-
display: none;
875-
}
876883
[data-toggle=true][aria-expanded=false] + * {
877884
display: none;
878885
}
879886

880-
[data-toggle=true][aria-expanded=true] .angle-down {
881-
display: none;
887+
[data-toggle=true][aria-expanded=true]::after {
888+
margin-block-start: 0.25rem;
889+
scale: -1;
882890
}
883891
[data-toggle=true][aria-expanded=true] + * {
884892
display: block;

public/dist/assets/styles/advanced.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)