mirror of
https://github.com/LukeHagar/developer.sailpoint.com.git
synced 2025-12-09 20:37:47 +00:00
added loading indicator to blog page
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
import BlogCard from '../BlogCard';
|
import BlogCard from '../BlogCard';
|
||||||
|
import BounceLoader from 'react-spinners/BounceLoader';
|
||||||
|
|
||||||
import {getBlogPosts, getTopic} from '../../../services/DiscourseService';
|
import {getBlogPosts, getTopic} from '../../../services/DiscourseService';
|
||||||
export default function BlogCards({
|
export default function BlogCards({
|
||||||
filterCallback
|
filterCallback
|
||||||
}) {
|
}) {
|
||||||
const [cardData, setCardData] = React.useState();
|
const [cardData, setCardData] = React.useState();
|
||||||
|
const [loadingCards, setLoadingCards] = React.useState(true);
|
||||||
|
|
||||||
const getPosts = async () => {
|
const getPosts = async () => {
|
||||||
const data = await getBlogPosts(filterCallback.join(','));
|
const data = await getBlogPosts(filterCallback.join(','));
|
||||||
@@ -19,11 +21,13 @@ export default function BlogCards({
|
|||||||
} else {
|
} else {
|
||||||
setCardData(undefined);
|
setCardData(undefined);
|
||||||
}
|
}
|
||||||
|
setLoadingCards(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
getPosts();
|
getPosts();
|
||||||
|
setCardData(undefined);
|
||||||
|
setLoadingCards(true);
|
||||||
}, [filterCallback]);
|
}, [filterCallback]);
|
||||||
|
|
||||||
if (cardData) {
|
if (cardData) {
|
||||||
@@ -48,8 +52,24 @@ export default function BlogCards({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
} else if (loadingCards) {
|
||||||
|
return (
|
||||||
|
<BounceLoader
|
||||||
|
className={styles.spinnerCenter}
|
||||||
|
color={'#0033a1'}
|
||||||
|
loading={true}
|
||||||
|
size={150}
|
||||||
|
aria-label="Loading Spinner"
|
||||||
|
data-testid="loader"
|
||||||
|
/>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return <div className={styles.noFound}> No Blog Post Found with the Given Search Criteria</div>;
|
return (
|
||||||
|
<div className={styles.noFound}>
|
||||||
|
{' '}
|
||||||
|
No Blogposts Found with the Given Search Criteria
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,3 +25,11 @@
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
margin: 50px;
|
margin: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.spinnerCenter {
|
||||||
|
margin: 100px auto;
|
||||||
|
max-width: 1300px;
|
||||||
|
margin-bottom: 50px;
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
|
||||||
|
|
||||||
export default function BlogSidebarButton({
|
export default function MarketplaceSidebarButton({
|
||||||
filterCallback,
|
filterCallback,
|
||||||
text
|
text
|
||||||
}) {
|
}) {
|
||||||
@@ -4,9 +4,9 @@ import styles from './styles.module.css';
|
|||||||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import { getTags } from '../../../services/DiscourseService';
|
import { getTags } from '../../../services/DiscourseService';
|
||||||
import BlogSidebarButton from './BlogSidebarButton';
|
import MarketplaceSidebarButton from './MarketplaceSidebarButton';
|
||||||
|
|
||||||
export default function BlogSidebar({
|
export default function MarketplaceSidebar({
|
||||||
filterCallback
|
filterCallback
|
||||||
}) {
|
}) {
|
||||||
const [tagProductData, setTagProductData] = React.useState();
|
const [tagProductData, setTagProductData] = React.useState();
|
||||||
@@ -47,16 +47,16 @@ export default function BlogSidebar({
|
|||||||
if (tagProductData && tagTechnologyData) {
|
if (tagProductData && tagTechnologyData) {
|
||||||
return (
|
return (
|
||||||
<div className={styles.sidebar}>
|
<div className={styles.sidebar}>
|
||||||
<div className={styles.tagHeader}>Posts by Product</div>
|
<div className={styles.tagHeader}>Items by Product</div>
|
||||||
<div className={styles.tagContainer}>
|
<div className={styles.tagContainer}>
|
||||||
{tagProductData.map(function(a, index){
|
{tagProductData.map(function(a, index){
|
||||||
return <BlogSidebarButton key={a} text={a} filterCallback={filterCallback}></BlogSidebarButton>
|
return <MarketplaceSidebarButton key={a} text={a} filterCallback={filterCallback}></MarketplaceSidebarButton>
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.tagHeader}>Posts by Identity Governance</div>
|
<div className={styles.tagHeader}>Items by Identity Governance</div>
|
||||||
<div className={styles.tagContainer}>
|
<div className={styles.tagContainer}>
|
||||||
{tagTechnologyData.map(function(a, index){
|
{tagTechnologyData.map(function(a, index){
|
||||||
return <div key={'div' + a} className={index > 10 && filterTags ? styles.hidden : ''} > <BlogSidebarButton key={a} text={a} filterCallback={filterCallback}></BlogSidebarButton></div>
|
return <div key={'div' + a} className={index > 10 && filterTags ? styles.hidden : ''} > <MarketplaceSidebarButton key={a} text={a} filterCallback={filterCallback}></MarketplaceSidebarButton></div>
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.seeAll} onClick={(e) => toggleSeeAll()}>
|
<div className={styles.seeAll} onClick={(e) => toggleSeeAll()}>
|
||||||
|
|||||||
Reference in New Issue
Block a user