1- import { h , Component } from 'preact' ;
1+ import { h , Component , VNode , Fragment } from 'preact' ;
22import * as style from './style.css' ;
33import 'add-css:./style.css' ;
44import { linkRef } from 'shared/prerendered-app/util' ;
5- import {
6- InfoIcon ,
7- DiamondStarIcon ,
8- ModalErrorIcon ,
9- } from 'client/lazy-app/icons' ;
105
116interface Props { }
127
138export interface ModalMessage {
14- type : 'info' | 'error' | 'update' ;
9+ icon : VNode ;
1510 title : string ;
16- content : string ;
11+ content : VNode ;
1712}
1813
1914interface State {
@@ -24,9 +19,9 @@ interface State {
2419export default class Modal extends Component < Props , State > {
2520 state : State = {
2621 message : {
27- type : 'info' ,
22+ icon : < svg > </ svg > ,
2823 title : 'default' ,
29- content : 'default' ,
24+ content : < Fragment > </ Fragment > ,
3025 } ,
3126 shown : false ,
3227 } ;
@@ -103,15 +98,7 @@ export default class Modal extends Component<Props, State> {
10398 onKeyDown = { ( e ) => this . _onKeyDown ( e ) }
10499 >
105100 < header class = { style . header } >
106- < span class = { style . modalTypeIcon } >
107- { message . type === 'info' ? (
108- < InfoIcon />
109- ) : message . type === 'error' ? (
110- < ModalErrorIcon />
111- ) : (
112- < DiamondStarIcon />
113- ) }
114- </ span >
101+ < span class = { style . modalIcon } > { message . icon } </ span >
115102 < span class = { style . modalTitle } > { message . title } </ span >
116103 < button class = { style . closeButton } onClick = { ( ) => this . hideModal ( ) } >
117104 < svg viewBox = "0 0 480 480" fill = "currentColor" >
@@ -125,10 +112,7 @@ export default class Modal extends Component<Props, State> {
125112 </ button >
126113 </ header >
127114 < div class = { style . contentContainer } >
128- < article
129- class = { style . content }
130- dangerouslySetInnerHTML = { { __html : message . content } }
131- > </ article >
115+ < article class = { style . content } > { message . content } </ article >
132116 </ div >
133117 < footer class = { style . footer } > </ footer >
134118 </ dialog >
0 commit comments