1
1
import TsLogo from '@sb/images/logo-ts.png' ;
2
2
import LinkDesign from '@ui5/webcomponents/dist/types/LinkDesign.js' ;
3
3
import MessageStripDesign from '@ui5/webcomponents/dist/types/MessageStripDesign.js' ;
4
- import { Avatar , Card , CardHeader , Link , MessageStrip , Text , ThemeProvider } from '@ui5/webcomponents-react' ;
4
+ import {
5
+ Avatar ,
6
+ Card ,
7
+ CardHeader ,
8
+ Label ,
9
+ Link ,
10
+ MessageStrip ,
11
+ Popover ,
12
+ Text ,
13
+ ThemeProvider
14
+ } from '@ui5/webcomponents-react' ;
5
15
import { clsx } from 'clsx' ;
6
- import { ReactNode } from 'react' ;
16
+ import { ReactNode , useRef , useState } from 'react' ;
7
17
import { addCustomCSSWithScoping } from '../../packages/main/src/internal/addCustomCSSWithScoping' ;
8
18
import classes from './ProjectTemplate.module.css' ;
9
19
@@ -18,6 +28,8 @@ interface ProjectTemplatePropTypes {
18
28
deprecationNotice ?: string ;
19
29
isTemplate ?: boolean ;
20
30
stackBlitzHref ?: string ;
31
+ showUnsupportedMessage ?: boolean ;
32
+ showNote ?: boolean ;
21
33
}
22
34
23
35
addCustomCSSWithScoping (
@@ -36,67 +48,128 @@ export function ProjectTemplate(props: ProjectTemplatePropTypes) {
36
48
href,
37
49
deprecationNotice,
38
50
isTemplate,
39
- stackBlitzHref
51
+ stackBlitzHref,
52
+ showUnsupportedMessage,
53
+ showNote
40
54
} = props ;
55
+ const [ popoverOpen , setPopoverOpen ] = useState ( false ) ;
56
+ const linkRef = useRef ( null ) ;
41
57
42
58
return (
43
59
< ThemeProvider >
44
- < Card
45
- className = { clsx ( classes . card , isTemplate && classes . template ) }
46
- header = {
47
- < CardHeader
48
- data-project-template = ""
49
- titleText = { title }
50
- subtitleText = { subtitle }
51
- action = {
52
- isTypeScript && (
53
- < img
54
- src = { TsLogo }
55
- height = { 24 }
56
- width = { 24 }
57
- alt = { 'TypeScript Logo' }
58
- title = { 'TypeScript Logo. Original Source: https://www.typescriptlang.org/branding/' }
59
- />
60
- )
61
- }
62
- avatar = {
63
- < Avatar title = { logoAttribution } >
64
- < img src = { logo } alt = { `Logo of ${ title } ` } />
65
- </ Avatar >
66
- }
67
- />
68
- }
69
- >
70
- < div className = { classes . cardContent } >
71
- { deprecationNotice && (
72
- < MessageStrip
73
- hideCloseButton
74
- design = { MessageStripDesign . Critical }
75
- children = { deprecationNotice }
76
- className = { classes . deprecationNotice }
77
- />
78
- ) }
79
- < Link design = { LinkDesign . Emphasized } href = { href } >
80
- View Example
81
- </ Link >
82
- { stackBlitzHref && (
83
- < >
84
- |
85
- < Link design = { LinkDesign . Emphasized } href = { stackBlitzHref } >
86
- View in StackBlitz
60
+ < div className = { clsx ( classes . cardContainer , isTemplate && classes . template ) } >
61
+ { showUnsupportedMessage && (
62
+ < >
63
+ < MessageStrip hideCloseButton design = { MessageStripDesign . Critical } className = { classes . unssupportedMessage } >
64
+ Currently not supported by V2.{ ' ' }
65
+ < Link
66
+ ref = { linkRef }
67
+ accessibleRole = "Button"
68
+ onClick = { ( ) => {
69
+ setPopoverOpen ( true ) ;
70
+ } }
71
+ >
72
+ Show more.
87
73
</ Link >
88
- </ >
89
- ) }
90
- { ! isTemplate && (
91
- < >
92
- < br />
93
- < br />
94
- < Text > What's included:</ Text >
95
- { children }
96
- </ >
97
- ) }
98
- </ div >
99
- </ Card >
74
+ </ MessageStrip >
75
+ < Popover
76
+ className = { classes . popover }
77
+ opener = { linkRef . current }
78
+ open = { popoverOpen }
79
+ onClose = { ( ) => {
80
+ setPopoverOpen ( false ) ;
81
+ } }
82
+ >
83
+ < Text >
84
+ Currently, the < code > BarcodeScannerDialog</ code > web component isn't compatible with SSR environments.
85
+ For the Next.js Pages Router and Remix, this bug crashes the entire build process, even if the component
86
+ isn't imported.
87
+ < br />
88
+ This is < b > not</ b > the case for the Next.js App Router; there, the build only crashes if the component
89
+ is used.
90
+ < br />
91
+ < br />
92
+ You can find the corresponding GitHub issue{ ' ' }
93
+ < Link href = "https://github.com/SAP/ui5-webcomponents/issues/9771" target = "_blank" >
94
+ here
95
+ </ Link >
96
+ .
97
+ </ Text >
98
+ </ Popover >
99
+ </ >
100
+ ) }
101
+ < Card
102
+ className = { clsx ( showUnsupportedMessage && classes . overlay ) }
103
+ header = {
104
+ < CardHeader
105
+ data-project-template = ""
106
+ titleText = { title }
107
+ subtitleText = { subtitle }
108
+ action = {
109
+ isTypeScript && (
110
+ < img
111
+ src = { TsLogo }
112
+ height = { 24 }
113
+ width = { 24 }
114
+ alt = { 'TypeScript Logo' }
115
+ title = { 'TypeScript Logo. Original Source: https://www.typescriptlang.org/branding/' }
116
+ />
117
+ )
118
+ }
119
+ avatar = {
120
+ < Avatar title = { logoAttribution } >
121
+ < img src = { logo } alt = { `Logo of ${ title } ` } />
122
+ </ Avatar >
123
+ }
124
+ />
125
+ }
126
+ >
127
+ < div className = { classes . cardContent } >
128
+ { deprecationNotice && (
129
+ < MessageStrip
130
+ hideCloseButton
131
+ design = { MessageStripDesign . Critical }
132
+ children = { deprecationNotice }
133
+ className = { classes . deprecationNotice }
134
+ />
135
+ ) }
136
+ < Link design = { LinkDesign . Emphasized } href = { href } >
137
+ View Example
138
+ </ Link >
139
+ { stackBlitzHref && (
140
+ < >
141
+ |
142
+ < Link design = { LinkDesign . Emphasized } href = { stackBlitzHref } >
143
+ View in StackBlitz
144
+ </ Link >
145
+ </ >
146
+ ) }
147
+ { showNote && (
148
+ < >
149
+ < br />
150
+ < span >
151
+ < Label showColon > Note</ Label >
152
+ < Text >
153
+ The < code > BarcodeScannerDialog</ code > component is currently{ ' ' }
154
+ < Link href = "https://github.com/SAP/ui5-webcomponents/issues/9771" target = "_blank" >
155
+ not supported
156
+ </ Link >
157
+ .
158
+ </ Text >
159
+ </ span >
160
+ </ >
161
+ ) }
162
+ { ! isTemplate && (
163
+ < >
164
+ < br />
165
+ < br />
166
+ < Text > What's included:</ Text >
167
+ { children }
168
+ </ >
169
+ ) }
170
+ </ div >
171
+ </ Card >
172
+ </ div >
100
173
</ ThemeProvider >
101
174
) ;
102
175
}
0 commit comments