Skip to content

Commit 3cb5e30

Browse files
Add webp screenshot support and display image in Currying B
1 parent c5a4608 commit 3cb5e30

3 files changed

Lines changed: 54 additions & 21 deletions

File tree

app-index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,12 @@ <h1>Prototype web apps for better project delivery</h1>
7272
card.dataset.tags=item.tags;
7373
const img=document.createElement('img');
7474
// Use the numeric id to load the matching screenshot in pics/
75-
img.src='pics/'+item['#']+'.png';
7675
img.alt=item.name;
77-
img.onerror=()=>{img.src='pics/blank.png';};
76+
img.src='pics/'+item['#']+'.png';
77+
img.onerror=()=>{
78+
img.onerror=()=>{img.src='pics/blank.png';};
79+
img.src='pics/'+item['#']+'.webp';
80+
};
7881
card.appendChild(img);
7982
const title=document.createElement('h3');
8083
const link=document.createElement('a');

apps/currying-B/src/App.css

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
11
.app-container {
22
font-family: 'Inter', sans-serif;
33
padding: 1rem;
4-
max-width: 800px;
4+
max-width: 1000px;
55
margin: auto;
66
}
77

8+
.layout {
9+
display: flex;
10+
gap: 1rem;
11+
align-items: flex-start;
12+
}
13+
14+
.content {
15+
flex: 1;
16+
}
17+
18+
.side-image {
19+
max-width: 300px;
20+
height: auto;
21+
}
22+
23+
@media (max-width: 768px) {
24+
.layout {
25+
flex-direction: column;
26+
}
27+
.side-image {
28+
align-self: center;
29+
max-width: 100%;
30+
}
31+
}
32+
833
.selectors {
934
display: flex;
1035
gap: 1rem;

apps/currying-B/src/App.jsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ export default function App() {
3737

3838
return (
3939
<div className="app-container">
40-
<h1>Currying Demonstration</h1>
40+
<div className="layout">
41+
<div className="content">
42+
<h1>Currying Demonstration</h1>
4143

42-
<div className="selectors">
43-
<label>Set A
44-
<select value={setA} onChange={e => setSetA(parseInt(e.target.value))}>
45-
{[1,2,3].map(n => <option key={n} value={n}>{n}</option>)}
46-
</select>
47-
</label>
44+
<div className="selectors">
45+
<label>Set A
46+
<select value={setA} onChange={e => setSetA(parseInt(e.target.value))}>
47+
{[1,2,3].map(n => <option key={n} value={n}>{n}</option>)}
48+
</select>
49+
</label>
4850
<label>Set B
4951
<select value={setB} onChange={e => setSetB(parseInt(e.target.value))}>
5052
{[1,2,3].map(n => <option key={n} value={n}>{n}</option>)}
@@ -55,14 +57,14 @@ export default function App() {
5557
{[1,2,3].map(n => <option key={n} value={n}>{n}</option>)}
5658
</select>
5759
</label>
58-
</div>
60+
</div>
5961

60-
<div className="grid">
61-
<div className="card">
62-
<h3>Regular Function (A × B) → C</h3>
63-
<p className="count">Total functions: {regularMappings.length}</p>
64-
<div className="list">
65-
{regularMappings.map((m, i) => (
62+
<div className="grid">
63+
<div className="card">
64+
<h3>Regular Function (A × B) → C</h3>
65+
<p className="count">Total functions: {regularMappings.length}</p>
66+
<div className="list">
67+
{regularMappings.map((m, i) => (
6668
<p key={i}>{m}</p>
6769
))}
6870
</div>
@@ -75,12 +77,15 @@ export default function App() {
7577
<p key={i}>{m}</p>
7678
))}
7779
</div>
80+
</div>
81+
</div>
82+
83+
<p className="explanation">
84+
This demonstration shows all possible mappings for both the regular and curried functions. Notice that while the representations are different, the total number of possible functions is the same, illustrating the isomorphism between Set(A × B, C) and Set(A, C^B).
85+
</p>
7886
</div>
87+
<img className="side-image" src="../../pics/1.webp" alt="Currying visualization" />
7988
</div>
80-
81-
<p className="explanation">
82-
This demonstration shows all possible mappings for both the regular and curried functions. Notice that while the representations are different, the total number of possible functions is the same, illustrating the isomorphism between Set(A × B, C) and Set(A, C^B).
83-
</p>
8489
</div>
8590
);
8691
}

0 commit comments

Comments
 (0)