Yacine Jernite commited on
Commit
b1f7a7d
β€’
1 Parent(s): d513711

imporove overview linking

Browse files
Files changed (3) hide show
  1. index.html +0 -43
  2. scripts/main.js +15 -4
  3. styles/style.css +54 -0
index.html CHANGED
@@ -7,49 +7,6 @@
7
  <link rel="stylesheet" href="styles/style.css" />
8
 
9
  <title>Machine Learning and Society @ πŸ€— </title>
10
-
11
- <style>
12
- /* Add CSS styles here */
13
- #vignettes {
14
- display: flex;
15
- }
16
- #itemSidebar {
17
- flex: 0 0 20%;
18
- max-width: 20%;
19
- border: 1px solid rgb(43, 145, 44);
20
- padding-left: 5px;
21
- margin-right: 5px;
22
- }
23
- #itemGallery {
24
- flex: 1;
25
- border: 1px solid rgb(43, 145, 44);
26
- display: grid;
27
- grid-template-columns: repeat(auto-fill, minmax(30%, 1fr));
28
- grid-auto-flow: row; /* This ensures items fill out columns before moving to the next row */
29
- }
30
- .item {
31
- border: 1px solid rgb(43, 145, 44);
32
- background-size: cover;
33
- background-position: center;
34
- height: 200px;
35
- position: relative;
36
- margin: 5px;
37
- }
38
- .item h3 {
39
- position: absolute;
40
- padding: 5px;
41
- text-align: center;
42
- }
43
- .item p {
44
- position: absolute;
45
- bottom: 0;
46
- background-color: #cbf5e1;
47
- margin: 0;
48
- padding: 5px;
49
- text-align: center;
50
- }
51
- </style>
52
-
53
  </head>
54
 
55
  <body>
 
7
  <link rel="stylesheet" href="styles/style.css" />
8
 
9
  <title>Machine Learning and Society @ πŸ€— </title>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  </head>
11
 
12
  <body>
scripts/main.js CHANGED
@@ -2,21 +2,21 @@
2
  const items = [
3
  {
4
  title: 'EvalEval Workshop',
5
- tags: ['privacy', 'bias', 'environment', 'measures', 'society'],
6
  image: 'images/hf-logo.png',
7
  link: 'projects.html#Evaluation',
8
  description: 'The EvalEval workshop is organized by our collaborative Social Impact Evaluation project.'
9
  },
10
  {
11
  title: 'Legal Hackathons',
12
- tags: ['regulation', 'education', 'finance', 'health', 'privacy', 'labor', 'society'],
13
  image: 'images/hf-logo.png',
14
  link: 'projects.html#Legal',
15
  description: 'The Legal Hackathons produce reports analyzing existing and proposed regulation.'
16
  },
17
  {
18
  title: 'AI Energy Scores',
19
- tags: ['environment', 'measures', 'society'],
20
  image: 'images/hf-logo.png',
21
  link: 'projects.html#Energy',
22
  description: 'This project works toward standardized reporting of energy costs of AI systems.'
@@ -36,6 +36,8 @@ const uniqueTags = [...new Set(items.flatMap(item => item.tags))];
36
  uniqueTags.forEach(tag => {
37
  const li = document.createElement('li');
38
  li.textContent = tag;
 
 
39
  li.addEventListener('click', () => displayItemsByTag(tag));
40
  tagList.appendChild(li);
41
  });
@@ -55,12 +57,21 @@ function displayItemsByTag(selectedTag) {
55
  itemDiv.id = `item-${itemCount}`;
56
  itemDiv.style.backgroundImage = `url(${item.image})`;
57
  itemDiv.innerHTML = `
58
- <h3>${item.title}</h3>
59
  <p>${item.description}</p>
60
  `;
61
  itemContainer.appendChild(itemDiv);
62
  });
63
 
 
 
 
 
 
 
 
 
 
64
  const showing = document.getElementById('sidebarShowing');
65
  showing.textContent = `Showing projects relevant to: ${selectedTag}`
66
  }
 
2
  const items = [
3
  {
4
  title: 'EvalEval Workshop',
5
+ tags: ['privacy', 'bias', 'environment', 'measuring', 'society'],
6
  image: 'images/hf-logo.png',
7
  link: 'projects.html#Evaluation',
8
  description: 'The EvalEval workshop is organized by our collaborative Social Impact Evaluation project.'
9
  },
10
  {
11
  title: 'Legal Hackathons',
12
+ tags: ['regulation', 'education', 'privacy', 'labor', 'society'],
13
  image: 'images/hf-logo.png',
14
  link: 'projects.html#Legal',
15
  description: 'The Legal Hackathons produce reports analyzing existing and proposed regulation.'
16
  },
17
  {
18
  title: 'AI Energy Scores',
19
+ tags: ['environment', 'measuring', 'society'],
20
  image: 'images/hf-logo.png',
21
  link: 'projects.html#Energy',
22
  description: 'This project works toward standardized reporting of energy costs of AI systems.'
 
36
  uniqueTags.forEach(tag => {
37
  const li = document.createElement('li');
38
  li.textContent = tag;
39
+ li.className = 'tagListItem'
40
+ li.id = `li-${tag}`
41
  li.addEventListener('click', () => displayItemsByTag(tag));
42
  tagList.appendChild(li);
43
  });
 
57
  itemDiv.id = `item-${itemCount}`;
58
  itemDiv.style.backgroundImage = `url(${item.image})`;
59
  itemDiv.innerHTML = `
60
+ <h3><a href="${item.link}">${item.title}</a></h3>
61
  <p>${item.description}</p>
62
  `;
63
  itemContainer.appendChild(itemDiv);
64
  });
65
 
66
+ const allTagListItems = document.getElementsByClassName('tagListItem')
67
+ for (const tli of allTagListItems) {
68
+ if (tli.id === `li-${selectedTag}`) {
69
+ tli.style.backgroundColor = "#cbf5e1";
70
+ } else {
71
+ tli.style.backgroundColor = "White";
72
+ }
73
+ }
74
+
75
  const showing = document.getElementById('sidebarShowing');
76
  showing.textContent = `Showing projects relevant to: ${selectedTag}`
77
  }
styles/style.css CHANGED
@@ -144,6 +144,60 @@ footer {
144
  margin-top: 10px;
145
  }
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  /* Previous css */
148
  /*
149
  html {
 
144
  margin-top: 10px;
145
  }
146
 
147
+ /* || Overview Gallery */
148
+ #vignettes {
149
+ display: flex;
150
+ }
151
+
152
+ #itemSidebar {
153
+ flex: 0 0 20%;
154
+ max-width: 20%;
155
+ border: 1px solid rgb(43, 145, 44);
156
+ padding-left: 5px;
157
+ margin-right: 5px;
158
+ }
159
+
160
+ #tagList {
161
+ padding: 5px;
162
+ list-style-type: none;
163
+ }
164
+
165
+ .tagListItem{
166
+ background-color: white;
167
+ border: 1px solid rgb(43, 145, 44);
168
+ padding: 2px;
169
+ margin: 2px;
170
+ }
171
+
172
+ #itemGallery {
173
+ flex: 1;
174
+ border: 1px solid rgb(43, 145, 44);
175
+ display: grid;
176
+ grid-template-columns: repeat(auto-fill, minmax(30%, 1fr));
177
+ grid-auto-flow: row; /* This ensures items fill out columns before moving to the next row */
178
+ }
179
+ .item {
180
+ border: 1px solid rgb(43, 145, 44);
181
+ background-size: cover;
182
+ background-position: center;
183
+ height: 200px;
184
+ position: relative;
185
+ margin: 5px;
186
+ }
187
+ .item h3 {
188
+ position: absolute;
189
+ padding: 5px;
190
+ text-align: center;
191
+ }
192
+ .item p {
193
+ position: absolute;
194
+ bottom: 0;
195
+ background-color: #cbf5e1;
196
+ margin: 0;
197
+ padding: 5px;
198
+ text-align: center;
199
+ }
200
+
201
  /* Previous css */
202
  /*
203
  html {