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

Adds placeholder-style loading to the ServiceItems #932

Merged
merged 4 commits into from
Jan 22, 2019

Conversation

prydonius
Copy link
Contributor

@prydonius prydonius commented Jan 18, 2019

The placeholder style loading is used in some webapps to show that text
content is loading. This is a better fit for the ServiceTables compared
to the LoadingSpinner.

The implementation adds a new type prop to the LoadingWrapper
component, which is used to determine which type of loader to render.
This could easily be extended to different types of loaders in the
future.

kubeapps-serviceitem-loadingplaceholder-infinite

kubeapps-serviceitem-loadingplaceholder

Copy link
Contributor

@migmartri migmartri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!

import LoadingPlaceholder from "./LoadingPlaceholder";

export enum LoaderType {
Spinner,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fancy enum :)


export interface ILoadingWrapperProps {
type?: LoaderType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a little bit worried about using such an overloaded term type. It does not seem a reserved word in JS though.

import LoadingSpinner from "../LoadingSpinner";
import LoadingPlaceholder from "./LoadingPlaceholder";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be a little bit more specific?

LoadingTextPlaceholder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the "placeholder" is a style in itself, just search for "placeholder loader" on Google and you come up with exactly what this is: https://www.google.com/search?q=placeholder+loader&oq=placeholder+loader&aqs=chrome.0.69i59j69i60j0l4.3666j1j7&sourceid=chrome&ie=UTF-8.

@@ -0,0 +1,25 @@
.LoadingPlaceholder {
height: 1em;
background-color: #f1f1f1;
Copy link
Contributor

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?

Copy link
Contributor Author

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


// Renders a placeholder loader style
// Based on https://kyusuf.com/post/fake-it-til-you-make-it-css/
const LoadingPlaceholder: React.SFC = props => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing tests, even if it is a simple snapshot one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Contributor

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!


// Renders a placeholder loader style
// Based on https://kyusuf.com/post/fake-it-til-you-make-it-css/
const LoadingPlaceholder: React.SFC = props => {
Copy link
Contributor

Choose a reason for hiding this comment

The 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

@prydonius prydonius merged commit da4bb19 into vmware-tanzu:master Jan 22, 2019
@prydonius prydonius deleted the 882-placeholder-loader branch January 22, 2019 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants