-
Notifications
You must be signed in to change notification settings - Fork 706
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
Adds placeholder-style loading to the ServiceItems #932
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
exports[`loading spinner matches the snapshot 1`] = ` | ||
<LoadingWrapper | ||
loaded={false} | ||
type={0} | ||
/> | ||
`; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
exports[`loading spinner matches the snapshot 1`] = ` | ||
<LoadingWrapper | ||
loaded={false} | ||
type={0} | ||
/> | ||
`; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.LoadingPlaceholder { | ||
height: 1em; | ||
background-color: #f1f1f1; | ||
position: relative; | ||
&:after { | ||
content: ""; | ||
position: absolute; | ||
width: 100%; | ||
height: 1em; | ||
background: linear-gradient( | ||
90deg, | ||
rgba(0, 0, 0, 0), | ||
rgba(255, 255, 255, 25%), | ||
rgba(0, 0, 0, 0) | ||
); | ||
transform: translateX(-30%); | ||
animation: loading 1.5s infinite; | ||
} | ||
} | ||
|
||
@keyframes loading { | ||
100% { | ||
transform: translateX(100%); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { shallow } from "enzyme"; | ||
import * as React from "react"; | ||
import LoadingPlaceholder from "./LoadingPlaceholder"; | ||
|
||
it("matches the snapshot", () => { | ||
const wrapper = shallow(<LoadingPlaceholder />); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as React from "react"; | ||
|
||
import "./LoadingPlaceholder.css"; | ||
|
||
// Renders a placeholder loader style | ||
// Based on https://kyusuf.com/post/fake-it-til-you-make-it-css/ | ||
const LoadingPlaceholder: React.SFC = props => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are missing tests, even if it is a simple snapshot one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw that the LoadingSpinner didn't have tests, but I can add them for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a lot to test but I guess it's something nice to have |
||
return <div className="LoadingPlaceholder" />; | ||
}; | ||
|
||
export default LoadingPlaceholder; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`matches the snapshot 1`] = ` | ||
<div | ||
className="LoadingPlaceholder" | ||
/> | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import LoadingPlaceholder from "./LoadingPlaceholder"; | ||
|
||
export default LoadingPlaceholder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that this is the minimum amount of CSS that we need? Do we need the background color set here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is the grey background colour that the lighter one animates over