Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shimmer card component in mine page #1284

Merged
merged 7 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/Unit/pages/Mine/Mine.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('Mine Page', () => {

await waitFor(() =>
expect(
getAllByTestId(/shimmer-card/i).length
getAllByTestId(/task-shimmer-card/i).length
).toBeGreaterThanOrEqual(1)
);
});
Expand Down
15 changes: 15 additions & 0 deletions src/components/Loaders/taskCardShimmer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import styles from './taskCardShimmer.module.scss';

const TaskCardShimmer = () => (
<div className={`${styles.taskCard}`} data-testid="task-shimmer-card">
<div className={`${styles.title} ${styles.animate}`}></div>
<div className={`${styles.flexContainer}`}>
<div className={`${styles.estimated} ${styles.animate}`}></div>
<div className={`${styles.status} ${styles.animate}`}></div>
</div>
<div className={`${styles.started} ${styles.animate}`} />
<div className={`${styles.assignee} ${styles.animate}`} />
</div>
);

export default TaskCardShimmer;
79 changes: 79 additions & 0 deletions src/components/Loaders/taskCardShimmer/taskCardShimmer.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
@import '../../../styles/variables.scss';

.taskCard {
border: 2px solid $white;
box-shadow: 0px 0px 10px 0 $light-gray;
padding: 10px;
border-radius: 8px;

width: 55vw;
min-width: 300px;
min-height: 110px;

margin-bottom: 2rem;

& > * {
border-radius: 8px;
margin: 10px;
}

.title {
min-height: 25px;
width: 60%;
}

.estimated {
min-height: 25px;
width: 40%;
}

.started {
min-height: 25px;
width: 20%;
}

.status {
min-width: 25px;
width: 20%;
}

.assignee {
min-height: 25px;
width: 30%;
}
}

@keyframes fullView {
100% {
width: 100%;
}
}

.flexContainer {
display: flex;
justify-content: space-between;

& > * {
border-radius: 8px;
}
}

.animate {
animation: shimmer 2s infinite linear;
background: linear-gradient(
to right,
$shimmer-lighter 4%,
$shimmer-darker 25%,
$shimmer-lighter 36%
);
background-size: 1000px 100%;
}

@keyframes shimmer {
0% {
background-position: -1000px 0;
}
100% {
background-position: 1000px 0;
}
}
6 changes: 3 additions & 3 deletions src/pages/mine/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getActiveTab } from '@/utils/getActiveTab';
import TaskList from '@/components/tasks/TaskList/TaskList';
import getInputValueFromTaskField from '@/utils/getInputValueFromTaskField';
import getFilteredTasks from '@/utils/getFilteredTasks';
import CardShimmer from '@/components/Loaders/cardShimmer';
import TaskCardShimmer from '@/components/Loaders/taskCardShimmer';

export const searchTasks = (
setFilteredTasks: (tasks: task[]) => void,
Expand Down Expand Up @@ -57,9 +57,9 @@ const Content = () => {

if (isLoading)
return (
<div className={styles.tasksContainer}>
<div className={styles.mineTasksContainer}>
pankajjs marked this conversation as resolved.
Show resolved Hide resolved
{[...Array(5)].map((n: number, index) => (
<CardShimmer key={index} />
<TaskCardShimmer key={index} />
))}
</div>
);
Expand Down
Loading