Skip to content

Commit db348a9

Browse files
Ishan VeerIshan Veer
authored andcommitted
created a separate component for loading spinner
1 parent 3c7dde3 commit db348a9

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const { createElement } = react;
2+
3+
export const LoadingSpinner = () => {
4+
return createElement('aside', { class: 'users_section' }, [
5+
createElement('div', { class: 'loading' }, ['Loading...']),
6+
]);
7+
};

users/discord/components/UsersSection.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { createElement } = react;
2+
import { LoadingSpinner } from './LoadingSpinner.js';
23

34
export const UsersSection = ({
45
users,
@@ -20,9 +21,7 @@ export const UsersSection = ({
2021
);
2122

2223
if (isLoading) {
23-
return createElement('aside', { class: 'users_section' }, [
24-
createElement('div', { class: 'loading' }, ['Loading...']),
25-
]);
24+
return LoadingSpinner();
2625
}
2726

2827
return createElement(
@@ -45,13 +44,6 @@ export const UsersSection = ({
4544
src: user?.picture?.url ?? dummyPicture,
4645
class: 'user_image',
4746
}),
48-
/* will uncomment this once we have actual paginated data from the API */
49-
50-
// createElement('span', {}, [
51-
// user.first_name + ' ' + user.last_name + user.username,
52-
// ]),
53-
54-
/* will remove this once we have actual paginated data from the API */
5547
createElement('span', {}, [user.username]),
5648
],
5749
);

0 commit comments

Comments
 (0)