File tree 3 files changed +45
-48
lines changed
3 files changed +45
-48
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ import styles from "./card.module.scss";
2
2
3
3
const Card = ( props ) => {
4
4
return (
5
- < div className = { `${ styles . root } ${ props . extraClasses } ` } >
5
+ < div
6
+ className = { `${ styles . root } ${ props . extraClasses } card` }
7
+ data-tags = { props . tags ?. map ( ( tag ) => tag ) }
8
+ >
6
9
{ props . logo && (
7
10
< a href = { props . link } className = { styles . logoHeader } >
8
11
< img
@@ -35,15 +38,16 @@ const Card = (props) => {
35
38
< img src = "/images/topic.svg" alt = "" />
36
39
Topics
37
40
</ span >
38
- { props . tags . map ( ( tag ) => (
39
- < button
40
- className = { styles . topic }
41
- key = { tag }
42
- onClick = { ( ) => props . tagChanger ( tag ) }
43
- >
44
- { tag }
45
- </ button >
46
- ) ) }
41
+ < div className = "card-tags" >
42
+ { props . tags . map ( ( tag ) => (
43
+ < button
44
+ className = { styles . topic }
45
+ onClick = { ( ) => props . tagChanger ( tag ) }
46
+ >
47
+ { tag }
48
+ </ button >
49
+ ) ) }
50
+ </ div >
47
51
</ div >
48
52
) }
49
53
{ props . topics && (
@@ -52,11 +56,13 @@ const Card = (props) => {
52
56
< img src = "/images/focus.svg" alt = "" />
53
57
Focus Areas
54
58
</ span >
55
- { props . topics . map ( ( topic ) => (
56
- < span key = { topic } className = { styles . topic } >
57
- { topic }
58
- </ span >
59
- ) ) }
59
+ < div className = "card-tags" >
60
+ { props . topics . map ( ( topic ) => (
61
+ < span key = { topic } className = { styles . topic } >
62
+ { topic }
63
+ </ span >
64
+ ) ) }
65
+ </ div >
60
66
</ div >
61
67
) }
62
68
</ div >
Original file line number Diff line number Diff line change 12
12
.service-card {
13
13
padding-bottom : 20px ;
14
14
}
15
+ .hidden {
16
+ display : none ;
17
+ }
15
18
}
16
19
17
20
.logoHeader {
78
81
}
79
82
}
80
83
81
- .cmsLink {
82
- position : absolute ;
83
- bottom : 0 ;
84
- right : 0 ;
85
- border-top-left-radius : 5px ;
86
- background : #ece9f7 ;
87
- text-decoration : none ;
88
- font-size : 0.9rem ;
89
- padding : 0.33rem 1rem ;
90
- & ::after {
91
- content : " " ;
92
- display : inline-block ;
93
- width : 1rem ;
94
- height : 1rem ;
95
- background : #4caa9f ;
96
- mask : url (/ images/netlify-cms.png );
97
- mask-size : cover ;
98
- position : relative ;
99
- top : 2px ;
100
- margin-left : 0.25rem ;
101
- }
102
- & :hover {
103
- background : #1a0e41 ;
104
- color : white ;
105
- }
106
- }
107
-
108
84
.cardContent {
109
85
padding : 1.5rem ;
110
86
color : #47356f ;
156
132
padding : 0 ;
157
133
color : #6a5a8a ;
158
134
text-transform : capitalize ;
159
- & :not (:nth-child (2 )) {
135
+ & :not (:nth-child (1 )) {
160
136
& ::before {
161
137
content : " ·" ;
162
138
margin : 0 0.33rem ;
Original file line number Diff line number Diff line change @@ -22,11 +22,7 @@ const tags = [...new Set(flatTags.map(JSON.stringify))].map(JSON.parse);
22
22
<nav class =" nav closed" id =" tagList" >
23
23
Topics:{ " " }
24
24
{ tags .map ((tag , i ) => {
25
- return (
26
- <button key = { tag } onClick = { () => onTagClick (tag )} class = " tag" >
27
- { tag }
28
- </button >
29
- );
25
+ return <button class = " tag" >{ tag } </button >;
30
26
})}
31
27
<button class =" more" id =" moreResourcesButton" > More </button >
32
28
</nav >
@@ -51,6 +47,25 @@ const tags = [...new Set(flatTags.map(JSON.stringify))].map(JSON.parse);
51
47
moreResourcesButton.addEventListener("click", () => {
52
48
tagList.classList.toggle("closed");
53
49
});
50
+
51
+ const cards = document.querySelectorAll(".card");
52
+ const tagButtons = document.querySelectorAll(
53
+ ".nav button:not(#moreResourcesButton), .card-tags button"
54
+ );
55
+ tagButtons.forEach((button) => {
56
+ button.addEventListener("click", () => {
57
+ let tagText = button.innerText.toLowerCase();
58
+ cards.forEach((card) => {
59
+ card.classList.add("hidden");
60
+ });
61
+ const cardsToShow = document.querySelectorAll(
62
+ ".card[data-tags*='" + tagText + "']"
63
+ );
64
+ cardsToShow.forEach((card) => {
65
+ card.classList.remove("hidden");
66
+ });
67
+ });
68
+ });
54
69
</script >
55
70
56
71
<style lang =" scss" >
You can’t perform that action at this time.
0 commit comments