Skip to content

Commit 0d0d2b8

Browse files
committed
test text samples out
1 parent 9d72895 commit 0d0d2b8

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

home.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ namespace microcode {
4040
x: buttonStart + 40,
4141
y: 30,
4242
onClick: () => {
43-
testSamples()
4443
// this.app.popScene()
4544
this.app.pushScene(new SamplesGallery(this.app))
4645
},

samples.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,31 @@ namespace microcode {
1212
}
1313
}
1414

15-
type textSampleList = {
15+
type rawSampleList = {
1616
label: string
1717
ariaId?: string
18-
src: string
18+
b64?: string
1919
// leave empty to hide sample
2020
icon?: string
2121
}[]
2222

23-
type rawSampleList = {
23+
export class TextSample {
24+
constructor(
25+
public readonly label: string,
26+
public readonly ariaId: string,
27+
public readonly icon: string,
28+
public readonly src: string
29+
) {}
30+
31+
get source() {
32+
return this.src
33+
}
34+
}
35+
36+
type textSampleList = {
2437
label: string
2538
ariaId?: string
26-
b64?: string
39+
src: string
2740
// leave empty to hide sample
2841
icon?: string
2942
}[]
@@ -257,6 +270,16 @@ namespace microcode {
257270
)
258271
}
259272

273+
export function textSamples(withIcon: boolean): TextSample[] {
274+
const s = newSamples()
275+
return s
276+
.filter(({ icon }) => !withIcon || !!icon)
277+
.map(
278+
({ label, ariaId, icon, src }) =>
279+
new TextSample(label, ariaId, icon, src)
280+
)
281+
}
282+
260283
function newSamples(): textSampleList {
261284
return [
262285
{

0 commit comments

Comments
 (0)