@@ -32,12 +32,18 @@ import classNames from "classnames";
32
32
import { ListGroup , ListGroupItem , UncontrolledTooltip } from "reactstrap" ;
33
33
import { CSSModule } from "reactstrap/types/lib/utils" ;
34
34
35
- export const ContentSummaryListGroupItem = ( { item, search, displayTopicTitle, noCaret, hideContentType, ignoreIntendedAudience} : {
35
+ export enum ContentTypeVisibility {
36
+ SHOWN , // default if not specified
37
+ ICON_ONLY ,
38
+ FULLY_HIDDEN
39
+ }
40
+
41
+ export const ContentSummaryListGroupItem = ( { item, search, showBreadcrumb, noCaret, contentTypeVisibility, ignoreIntendedAudience} : {
36
42
item : ShortcutResponse ;
37
43
search ?: string ;
38
- displayTopicTitle ?: boolean ;
44
+ showBreadcrumb ?: boolean ;
39
45
noCaret ?: boolean ;
40
- hideContentType ?: boolean ;
46
+ contentTypeVisibility ?: ContentTypeVisibility ;
41
47
ignoreIntendedAudience ?: boolean ;
42
48
} ) => {
43
49
const componentId = useRef ( uuid_v4 ( ) . slice ( 0 , 4 ) ) . current ;
@@ -145,18 +151,18 @@ export const ContentSummaryListGroupItem = ({item, search, displayTopicTitle, no
145
151
146
152
return < ListGroupItem className = { classNames ( itemClasses , { "p-3 d-md-flex flex-column justify-content-center content-summary-item" : isPhy } ) } key = { linkDestination } >
147
153
< Link className = { classNames ( { "position-relative justify-content-center" : isAda } ) } to = { { pathname : linkDestination , search : search , hash : hash } } >
148
- < span className = { classNames ( { "content-summary-link-title align-self-center" : isPhy , "question-progress-icon" : isAda } ) } >
154
+ { contentTypeVisibility !== ContentTypeVisibility . FULLY_HIDDEN && < span className = { classNames ( { "content-summary-link-title align-self-center" : isPhy , "question-progress-icon" : isAda } ) } >
149
155
{ siteSpecific (
150
156
icon ,
151
157
< div className = { "inner-progress-icon" } >
152
158
{ icon }
153
- { ! hideContentType && < >
159
+ { contentTypeVisibility !== ContentTypeVisibility . ICON_ONLY && < >
154
160
< br />
155
161
< span className = { "icon-title" } > { typeLabel } </ span >
156
162
</ > }
157
163
</ div >
158
164
) }
159
- </ span >
165
+ </ span > }
160
166
< div className = { classNames ( "flex-fill" , { "py-3 pe-3 align-content-center" : isAda , "d-flex" : isAda && ! stack , "d-md-flex" : isPhy } ) } >
161
167
< div className = { "align-self-center " + titleClasses } >
162
168
< div className = "d-flex" >
@@ -167,12 +173,12 @@ export const ContentSummaryListGroupItem = ({item, search, displayTopicTitle, no
167
173
({ typeLabel } )
168
174
</ span > }
169
175
{ isPhy && item . supersededBy && isTeacherOrAbove ( user ) ? < a
170
- className = "superseded-tag ms -1 ms-sm-3"
176
+ className = "superseded-tag mx -1 ms-sm-3"
171
177
href = { `/questions/${ item . supersededBy } ` }
172
178
onClick = { ( e ) => e . stopPropagation ( ) }
173
179
> SUPERSEDED</ a > : null }
174
180
{ isPhy && item . tags && item . tags . includes ( "nofilter" ) && isStaff ( user ) ? < span
175
- className = "superseded-tag ms -1 ms-sm-3"
181
+ className = "superseded-tag mx -1 ms-sm-3"
176
182
> NO-FILTER</ span > : null }
177
183
</ div >
178
184
{ ( isPhy && item . summary ) && < div className = "small text-muted d-none d-sm-block" >
@@ -181,7 +187,7 @@ export const ContentSummaryListGroupItem = ({item, search, displayTopicTitle, no
181
187
{ ( ! item . summary || deviceSize === "xs" ) && item . subtitle && < div className = "small text-muted d-block" >
182
188
{ item . subtitle }
183
189
</ div > }
184
- { displayTopicTitle && hierarchyTags && < div className = { "hierarchy-tags d-none d-md-block" } >
190
+ { showBreadcrumb && hierarchyTags && < div className = { "hierarchy-tags d-none d-md-block" } >
185
191
{ hierarchyTags . map ( tag => ( < span className = "hierarchy-tag" key = { tag . id } > { tag . title } </ span > ) ) }
186
192
</ div > }
187
193
</ div >
@@ -199,12 +205,12 @@ export const ContentSummaryListGroupItem = ({item, search, displayTopicTitle, no
199
205
</ ListGroupItem > ;
200
206
} ;
201
207
202
- export const LinkToContentSummaryList = ( { items, search, displayTopicTitle , noCaret, hideContentType , ignoreIntendedAudience, ...rest } : {
208
+ export const LinkToContentSummaryList = ( { items, search, showBreadcrumb , noCaret, contentTypeVisibility , ignoreIntendedAudience, ...rest } : {
203
209
items : ContentSummaryDTO [ ] ;
204
210
search ?: string ;
205
- displayTopicTitle ?: boolean ;
211
+ showBreadcrumb ?: boolean ;
206
212
noCaret ?: boolean ;
207
- hideContentType ?: boolean ;
213
+ contentTypeVisibility ?: ContentTypeVisibility ;
208
214
ignoreIntendedAudience ?: boolean ;
209
215
tag ?: React . ElementType ;
210
216
flush ?: boolean ;
@@ -214,8 +220,8 @@ export const LinkToContentSummaryList = ({items, search, displayTopicTitle, noCa
214
220
return < ListGroup { ...rest } className = { "link-list list-group-links mb-3" + rest . className } >
215
221
{ items . map ( item => < ContentSummaryListGroupItem
216
222
item = { item } search = { search } noCaret = { noCaret }
217
- key = { item . type + "/" + item . id } displayTopicTitle = { displayTopicTitle }
218
- hideContentType = { hideContentType } ignoreIntendedAudience = { ignoreIntendedAudience }
223
+ key = { item . type + "/" + item . id } showBreadcrumb = { showBreadcrumb }
224
+ contentTypeVisibility = { contentTypeVisibility } ignoreIntendedAudience = { ignoreIntendedAudience }
219
225
/> ) }
220
226
</ ListGroup > ;
221
227
} ;
0 commit comments