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

Add spec loading state and animation #7709

Merged
merged 4 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add loading state and animation
  • Loading branch information
panzarino committed Jun 15, 2020
commit 484a0351268e0542f1d53e001d3b9e3c85048def
61 changes: 61 additions & 0 deletions packages/reporter/src/runnables/runnables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,65 @@
margin-right: 5px;
}
}

.runnable-loading {
.runnable-loading-animation {
display: flex;
margin: 3.5rem auto 1.5rem;
padding: 0 5px;
width: 160px;

div {
animation: scaling 1.65s linear infinite;
panzarino marked this conversation as resolved.
Show resolved Hide resolved
border-radius: 50%;
height: 40px;
margin: 0 -5px;
transform: scale(0.5);
width: 40px;
}

div:nth-child(1){
panzarino marked this conversation as resolved.
Show resolved Hide resolved
animation-delay:0.1s;
background: #56b790;
}

div:nth-child(2){
panzarino marked this conversation as resolved.
Show resolved Hide resolved
animation-delay:0.2s;
background: #4a88cc;
}

div:nth-child(3){
panzarino marked this conversation as resolved.
Show resolved Hide resolved
animation-delay:0.3s;
background: #b96162;
}

div:nth-child(4){
panzarino marked this conversation as resolved.
Show resolved Hide resolved
animation-delay:0.4s;
background: #e3b065;
}

div:nth-child(5){
panzarino marked this conversation as resolved.
Show resolved Hide resolved
animation-delay:0.5s;
background: #a9abad;
}

@keyframes scaling{
panzarino marked this conversation as resolved.
Show resolved Hide resolved
0%, 20%, 80%, 100%{
panzarino marked this conversation as resolved.
Show resolved Hide resolved
opacity: 100%;
transform: scale(0.5);
}

50%{
panzarino marked this conversation as resolved.
Show resolved Hide resolved
opacity: 50%;
transform: scale(1);
}
}
}

.runnable-loading-title {
font-family: $muli;
font-size: 20px;
text-align: center;
}
}
}
17 changes: 16 additions & 1 deletion packages/reporter/src/runnables/runnables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ const noTestsError = (specPath: string) => ({
message: 'We could not detect any tests in the above file. Write some tests and re-run.',
})

const Loading = () => (
<div className="runnable-loading">
<div className="runnable-loading-animation">
<div />
<div />
<div />
<div />
<div />
</div>
<div className="runnable-loading-title">Your tests are loading...</div>
</div>
)

interface RunnablesListProps {
runnables: RunnableArray
}
Expand All @@ -30,7 +43,9 @@ const RunnablesList = observer(({ runnables }: RunnablesListProps) => (
))

function content ({ isReady, runnables }: RunnablesStore, specPath: string, error?: Error) {
if (!isReady) return null
if (!isReady) {
return <Loading />
}

// show error if there are no tests, but only if there
// there isn't an error passed down that supercedes it
Expand Down