Skip to content

Commit

Permalink
Update modal demo
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanpingle committed Jul 1, 2023
1 parent f001dac commit 01c7859
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/features/encoders/mozJPEG/client/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EncodeOptions, MozJpegColorSpace } from '../shared/meta';
import type WorkerBridge from 'client/lazy-app/worker-bridge';
import { h, Component, Fragment } from 'preact';
import { h, Component, Fragment, VNode } from 'preact';
import {
inputFieldChecked,
inputFieldValueAsNumber,
Expand All @@ -15,8 +15,12 @@ import Select from 'client/lazy-app/Compress/Options/Select';
import Revealer from 'client/lazy-app/Compress/Options/Revealer';
import { ModalMessage } from 'client/lazy-app/Modal';
import ModalContext from 'client/lazy-app/Modal/modal-context';
import { shallowRender as renderToString } from 'preact-render-to-string';
import * as SampleImage from 'img-url:static-build/assets/link.jpg';
import {
DiamondStarIcon,
InfoIcon,
ModalErrorIcon,
} from 'client/lazy-app/icons';

export function encode(
signal: AbortSignal,
Expand All @@ -36,8 +40,8 @@ interface State {
showAdvanced: boolean;
}

function sampleDescription(): string {
return renderToString(
function sampleDescription(): VNode {
return (
<Fragment>
<h1>Test Suite (h1)</h1>
<p>This is a paragraph.</p>
Expand Down Expand Up @@ -72,7 +76,7 @@ function sampleDescription(): string {
</a>
.
</p>
</Fragment>,
</Fragment>
);
}

Expand Down Expand Up @@ -173,7 +177,7 @@ export class Options extends Component<Props, State> {
name="NULL"
onClick={() =>
this._showModal({
type: 'info',
icon: <InfoIcon />,
title: 'Informative Title',
content: sampleDescription(),
})
Expand All @@ -186,7 +190,7 @@ export class Options extends Component<Props, State> {
name="NULL"
onClick={() =>
this._showModal({
type: 'error',
icon: <ModalErrorIcon />,
title: 'Error Title',
content: sampleDescription(),
})
Expand All @@ -199,7 +203,7 @@ export class Options extends Component<Props, State> {
name="NULL"
onClick={() =>
this._showModal({
type: 'update',
icon: <DiamondStarIcon />,
title: 'Feature Title',
content: sampleDescription(),
})
Expand Down

0 comments on commit 01c7859

Please sign in to comment.