Skip to content

Commit 89cd5df

Browse files
committed
Basic ModalHint demo
1 parent e7bef95 commit 89cd5df

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

src/features/encoders/mozJPEG/client/index.tsx

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EncodeOptions, MozJpegColorSpace } from '../shared/meta';
22
import type WorkerBridge from 'client/lazy-app/worker-bridge';
3-
import { h, Component } from 'preact';
3+
import { h, Component, Fragment } from 'preact';
44
import {
55
inputFieldChecked,
66
inputFieldValueAsNumber,
@@ -13,6 +13,8 @@ import Checkbox from 'client/lazy-app/Compress/Options/Checkbox';
1313
import Expander from 'client/lazy-app/Compress/Options/Expander';
1414
import Select from 'client/lazy-app/Compress/Options/Select';
1515
import Revealer from 'client/lazy-app/Compress/Options/Revealer';
16+
import ModalHint from 'client/lazy-app/Modal/ModalHelpIcon';
17+
import * as linkImage from 'img-url:static-build/assets/link.jpg';
1618

1719
export function encode(
1820
signal: AbortSignal,
@@ -23,6 +25,53 @@ export function encode(
2325
return workerBridge.mozjpegEncode(signal, imageData, options);
2426
}
2527

28+
function sampleContent() {
29+
return (
30+
<Fragment>
31+
<h1>Test Suite (h1)</h1>
32+
<p>
33+
Let's say, hypothetically, this paragraph links to{' '}
34+
<ModalHint modalTitle={'Nested'} content={<h1>WASSUP</h1>}>
35+
Trellis Multipass
36+
</ModalHint>
37+
. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quaerat ad
38+
maiores iure suscipit numquam voluptate.
39+
</p>
40+
<p>
41+
This is <i>another</i> paragraph. Notice how <b>another</b> uses
42+
italics. Oh wait, I just used the &lt;b&gt; tag. Oh, and escaped HTML
43+
unicode thingies. Now I'm just rambling so that this is long enough to
44+
be multi-line, and you can see the line-height.
45+
</p>
46+
<hr />
47+
<pre>
48+
# Which is the best programming language?
49+
<br />
50+
print("Python is!")
51+
<br />
52+
Oh and this is all in &lt;pre&gt;
53+
</pre>
54+
<p>
55+
<strong>This text is strong</strong>. And <code>this</code> is in
56+
&lt;code&gt;.
57+
</p>
58+
<figure>
59+
<img src={linkImage.default} alt="Alt Text" />
60+
<figcaption>
61+
Source: Nintendo EDP / Nintendo (and this is a figcaption)
62+
</figcaption>
63+
</figure>
64+
<p>
65+
That's a link.{' '}
66+
<a href="https://www.zelda.com/tears-of-the-kingdom/">
67+
This is also a link
68+
</a>
69+
.
70+
</p>
71+
</Fragment>
72+
);
73+
}
74+
2675
interface Props {
2776
options: EncodeOptions;
2877
onChange(newOptions: EncodeOptions): void;
@@ -114,6 +163,10 @@ export class Options extends Component<Props, State> {
114163
value={options.quality}
115164
onInput={this.onChange}
116165
>
166+
<ModalHint
167+
modalTitle="mozJPEG - quality"
168+
content={sampleContent()}
169+
></ModalHint>
117170
Quality:
118171
</Range>
119172
</div>

src/static-build/assets/link.jpg

70.5 KB
Loading

0 commit comments

Comments
 (0)