-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
117 additions
and
100 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
10 changes: 0 additions & 10 deletions
10
packages/page-typing-test/lib/components/LineTemplate.module.less
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,13 +1,3 @@ | ||
.line { | ||
display: flex; | ||
align-items: center; | ||
border-block-end: var(--separator-border); | ||
} | ||
|
||
.text { | ||
flex: auto; | ||
} | ||
|
||
.stats { | ||
text-align: end; | ||
} |
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,33 +1,12 @@ | ||
import { formatDuration, Value } from "@keybr/widget"; | ||
import { memo, type ReactNode } from "react"; | ||
import { type Progress, type SessionLine } from "../session/index.ts"; | ||
import { type SessionLine } from "../session/index.ts"; | ||
import * as styles from "./LineTemplate.module.less"; | ||
|
||
export const LineTemplate = memo(function LineTemplate({ | ||
children, | ||
progress, | ||
}: { | ||
readonly children: ReactNode; | ||
} & SessionLine): ReactNode { | ||
return ( | ||
<div className={styles.line}> | ||
<div className={styles.text}>{children}</div> | ||
<div className={styles.stats}>{progress && <Stats {...progress} />}</div> | ||
</div> | ||
); | ||
} & SessionLine) { | ||
return <div className={styles.line}>{children}</div>; | ||
}); | ||
|
||
function Stats({ length, time, progress }: Progress): ReactNode { | ||
return ( | ||
<> | ||
<Value | ||
value={formatDuration(time, { showMillis: true })} | ||
title="Time passed." | ||
/> | ||
{" / "} | ||
<Value value={`${length}`} title="Characters inputted." /> | ||
{" / "} | ||
<Value value={`${Math.floor(progress * 100)}%`} title="Progress made." /> | ||
</> | ||
); | ||
} |
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
18 changes: 18 additions & 0 deletions
18
packages/page-typing-test/lib/components/TestProgress.module.less
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,18 @@ | ||
.root { | ||
position: relative; | ||
background-color: var(--primary-l1); | ||
} | ||
|
||
.bar { | ||
position: absolute; | ||
inset-inline-start: 0; | ||
inset-block-start: 0; | ||
inset-block-end: 0; | ||
background-color: var(--primary-d1); | ||
} | ||
|
||
.info { | ||
position: relative; | ||
inset: 0; | ||
text-align: center; | ||
} |
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,34 @@ | ||
import { useIntlNumbers } from "@keybr/intl"; | ||
import { useFormatter } from "@keybr/lesson-ui"; | ||
import { formatDuration, Para, Value, withDeferred } from "@keybr/widget"; | ||
import { memo } from "react"; | ||
import { type Progress } from "../session/index.ts"; | ||
import * as styles from "./TestProgress.module.less"; | ||
|
||
export const TestProgress0 = memo(function TestProgress({ | ||
progress: { length, time, progress, speed }, | ||
}: { | ||
readonly progress: Progress; | ||
}) { | ||
const { formatNumber, formatPercents } = useIntlNumbers(); | ||
const { formatSpeed } = useFormatter(); | ||
return ( | ||
<Para className={styles.root}> | ||
<div | ||
className={styles.bar} | ||
style={{ inlineSize: `${Math.floor(progress * 100)}%` }} | ||
/> | ||
<div className={styles.info}> | ||
<Value value={formatDuration(time, { showMillis: true })} /> | ||
{" / "} | ||
<Value value={formatNumber(length)} /> | ||
{" / "} | ||
<Value value={formatPercents(progress)} /> | ||
{" / "} | ||
<Value value={formatSpeed(speed)} /> | ||
</div> | ||
</Para> | ||
); | ||
}); | ||
|
||
export const TestProgress = withDeferred(TestProgress0); |
2 changes: 2 additions & 0 deletions
2
packages/page-typing-test/lib/components/TestScreen.module.less
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,5 +1,7 @@ | ||
.text { | ||
max-inline-size: 60rem; | ||
margin: -1rem; | ||
padding: 1rem; | ||
overflow: hidden; | ||
backdrop-filter: blur(10px); | ||
} |
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
3 changes: 0 additions & 3 deletions
3
packages/page-typing-test/lib/components/settings/TypingSettings.module.less
This file was deleted.
Oops, something went wrong.
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