Skip to content

Commit c4eb0ee

Browse files
make braille website
1 parent 28df554 commit c4eb0ee

File tree

2 files changed

+70
-2
lines changed

2 files changed

+70
-2
lines changed

src/tests/braille.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Braille Glyph Recipes</title>
8+
<style>
9+
* {
10+
box-sizing: border-box;
11+
margin: 0;
12+
padding: 0;
13+
}
14+
#app {
15+
position: absolute;
16+
inset: 0;
17+
display: grid;
18+
place-items: center;
19+
}
20+
#container {
21+
width: 100%;
22+
display: grid;
23+
grid-template-columns: repeat(16, 1fr);
24+
background-color: #eee;
25+
}
26+
#container > div {
27+
aspect-ratio: 1 / 1;
28+
display: flex;
29+
flex-direction: column;
30+
justify-content: center;
31+
align-self: center;
32+
background-color: #fff;
33+
border-top: 1px solid #ddd;
34+
border-left: 1px solid #ddd;
35+
}
36+
#container > div.clicked {
37+
background-color: #eee;
38+
}
39+
#container > div > p:first-of-type {
40+
font-family: monospace;
41+
font-size: 0.5vw;
42+
text-align: center;
43+
}
44+
#container > div > p:last-of-type {
45+
font-family: monospace;
46+
font-size: 3vw;
47+
text-align: center;
48+
}
49+
</style>
50+
</head>
51+
<body>
52+
<div id="app">
53+
<div id="container"></div>
54+
</div>
55+
<script src="braille.js"></script>
56+
</body>
57+
</html>

src/tests/braille.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ function brailleRecipes() {
1515
7: [0, "bd3"],
1616
8: ["bd1", "bd3"],
1717
}
18+
const container = document.querySelector("#container")
1819

20+
const blank = document.createElement("div")
21+
blank.innerHTML = `<p>brblank</p><p>${String.fromCharCode(10240)}</p>`
22+
container.append(blank)
1923
for (let i = 1; i < 256; i++) {
2024
const name =
2125
"dots" +
@@ -41,8 +45,15 @@ function brailleRecipes() {
4145
)
4246
.join("+")
4347
// console.log(i.toString(2), dots, dotPositions)
44-
console.log(name, recipe)
48+
const div = document.createElement("div")
49+
div.innerHTML = `<p>${name}</p><p>${String.fromCharCode(10240 + i)}</p>`
50+
div.addEventListener("click", () => {
51+
div.classList.toggle("clicked")
52+
navigator.clipboard.writeText(recipe)
53+
})
54+
container.append(div)
55+
// console.log(name, recipe)
4556
}
46-
console.log(positions)
57+
// console.log(positions)
4758
}
4859
brailleRecipes()

0 commit comments

Comments
 (0)