File tree Expand file tree Collapse file tree 2 files changed +52
-5
lines changed
Expand file tree Collapse file tree 2 files changed +52
-5
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import AccordionItemsList from './AccordionItemsList';
77import RecordDetailHeader from './RecordDetailHeader' ;
88import type { RelatedRecordsList } from '../types/RelatedRecordsList' ;
99import RecordDetailBreadcrumbs from './RecordDetailBreadcrumbs' ;
10+ import LoadAnimation from './LoadAnimation' ;
1011
1112type Props = {
1213 /**
@@ -45,6 +46,11 @@ type Props = {
4546 */
4647 icon ?: string ,
4748
49+ /**
50+ * If true, displays a loading icon in place of the related records list
51+ */
52+ loading ?: Boolean ,
53+
4854 /**
4955 * A function called when the `close` icon is clicked
5056 */
@@ -113,11 +119,15 @@ const RecordDetailPanel = (props: Props) => (
113119 { props . children }
114120 </ RecordDetailHeader >
115121 </ div >
116- < AccordionItemsList
117- className = { clsx ( props . classNames ?. relatedRecords ) }
118- items = { props . relations }
119- count = { props . count }
120- />
122+ { props . loading
123+ ? < div className = 'py-4 px-8' > < LoadAnimation /> </ div >
124+ : (
125+ < AccordionItemsList
126+ className = { clsx ( props . classNames ?. relatedRecords ) }
127+ items = { props . relations }
128+ count = { props . count }
129+ />
130+ ) }
121131 </ div >
122132) ;
123133
Original file line number Diff line number Diff line change @@ -322,3 +322,40 @@ export const NoRelatedRecords = () => (
322322 </ p >
323323 </ RecordDetailPanel >
324324) ;
325+
326+ export const WithLoadingDelay = ( ) => {
327+ const [ loading , setLoading ] = useState ( true ) ;
328+
329+ useEffect ( ( ) => {
330+ setTimeout ( ( ) => {
331+ setLoading ( false ) ;
332+ } , 3000 ) ;
333+ } , [ ] ) ;
334+
335+ return (
336+ < RecordDetailPanel
337+ loading = { loading }
338+ relations = { sampleData }
339+ title = 'West Tokyo Qualifiers Quarterfinal'
340+ detailItems = { [
341+ {
342+ text : 'July 27' ,
343+ icon : 'date'
344+ } ,
345+ {
346+ text : 'Meiji Jinju Stadium' ,
347+ icon : 'location'
348+ }
349+ ] }
350+ >
351+ < p >
352+ Arcu imperdiet sit sit viverra id volutpat commodo.
353+ { ' ' }
354+ < span className = 'font-bold' > Tempor sem malesuada porttitor congue.</ span >
355+ { ' ' }
356+ Nibh aenean vitae blandit vitae sapien ac varius mattis.
357+ Aliquam vitae purus arcu eros enim tempus parturient orci fames.
358+ </ p >
359+ </ RecordDetailPanel >
360+ ) ;
361+ } ;
You can’t perform that action at this time.
0 commit comments