-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move page specific css into own files
Use CSS to reveal quiz options rather than streaming delays, which no longer works in Chrome Add a 'ready' class to body after page load
- Loading branch information
Showing
16 changed files
with
139 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import { byMethod } from "@http/route/by-method"; | ||
import { serveDir } from "@std/http/file-server"; | ||
import { fromFileUrl } from "@std/path/from-file-url"; | ||
import { interceptResponse, skip } from "@http/interceptor/intercept"; | ||
|
||
export default byMethod({ | ||
GET(req, match: URLPatternResult) { | ||
const path = match.pathname.groups.path ?? ""; | ||
const urlRoot = match.pathname.input.slice(1, -path.length); | ||
const fsRoot = fromFileUrl( | ||
import.meta.resolve(`../routes/${urlRoot}_static`), | ||
); | ||
return serveDir(req, { quiet: true, fsRoot, urlRoot }); | ||
}, | ||
}); | ||
export default interceptResponse( | ||
byMethod({ | ||
GET(req, match: URLPatternResult) { | ||
const path = match.pathname.groups.path ?? ""; | ||
const urlRoot = match.pathname.input.slice(1, -path.length); | ||
const fsRoot = fromFileUrl( | ||
import.meta.resolve(`../routes/${urlRoot}_static`), | ||
); | ||
return serveDir(req, { quiet: true, fsRoot, urlRoot }); | ||
}, | ||
}), | ||
skip(404, 405), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
setTimeout(() => { | ||
document.body.classList.add("ready"); | ||
}, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#result.result { | ||
color: green; | ||
} | ||
#result.error { | ||
color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
.ex-swap { | ||
font-size: small; | ||
font-weight: normal; | ||
} | ||
|
||
.result { | ||
color: green; | ||
} | ||
.error { | ||
color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
.quiz { | ||
border-style: solid; | ||
border-width: 2px 1ex 1ex 2px; | ||
border-color: blueviolet; | ||
border-radius: 2em; | ||
padding: 1em 2em; | ||
margin: 1em 0; | ||
} | ||
|
||
.quiz .question { | ||
font-weight: bold; | ||
} | ||
|
||
.quiz .attribution { | ||
font-size: smaller; | ||
font-style: italic; | ||
} | ||
|
||
.quiz .answer button { | ||
border-style: solid; | ||
border-width: 1px 3px 3px 1px; | ||
border-color: darkcyan; | ||
background-color: lightblue; | ||
border-radius: 1em; | ||
padding: 0.5em 1em; | ||
margin: 1ex 0; | ||
font-size: inherit; | ||
} | ||
|
||
.quiz .answer button.correct { | ||
border-color: darkseagreen; | ||
background-color: lightgreen; | ||
} | ||
|
||
.quiz .answer button.incorrect { | ||
border-color: salmon; | ||
background-color: lightpink; | ||
} | ||
|
||
.quiz .answer button { | ||
opacity: 0; | ||
transform: scale(0); | ||
filter: blur(5px); | ||
transition-property: all; | ||
transition-duration: 1s; | ||
} | ||
|
||
.ready .quiz .answer button { | ||
opacity: 1; | ||
transform: scale(1); | ||
filter: blur(0); | ||
} | ||
|
||
.quiz .answer:nth-of-type(1) button { | ||
transition-delay: 0.5s; | ||
} | ||
|
||
.quiz .answer:nth-of-type(2) button { | ||
transition-delay: 1s; | ||
} | ||
|
||
.quiz .answer:nth-of-type(3) button { | ||
transition-delay: 1.5s; | ||
} | ||
|
||
.quiz .answer:nth-of-type(4) button { | ||
transition-delay: 2s; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
.todo-item * { | ||
display: inline; | ||
margin: 2px 4px; | ||
} |