Socket
Socket
Sign inDemoInstall

react-loading-skeleton

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-loading-skeleton - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

3

package.json
{
"name": "react-loading-skeleton",
"version": "2.0.1",
"version": "2.1.0",
"license": "MIT",

@@ -8,2 +8,3 @@ "author": "David Tang",

"main": "lib/index.js",
"types": "lib/index.d.ts",
"sideEffects": false,

@@ -10,0 +11,0 @@ "browserslist": [

@@ -1,2 +0,2 @@

import { Component, ReactNode } from "react";
import { Component, ReactNode, CSSProperties } from "react";

@@ -12,2 +12,4 @@ export default class Skeleton extends Component<SkeletonProps> {}

circle?: boolean;
style?: CSSProperties;
className?: string;
}

@@ -14,0 +16,0 @@

@@ -20,1 +20,23 @@ import React from "react";

});
it("should render a skeleton with styles", () => {
const style = { boarderRadius: 10, height: 50, width: 50 };
const skeleton = mount(<Skeleton style={style} />);
expect(skeleton.find(skeletonSelector).prop("style")).toEqual(style);
});
it("inline style prop should overwrite custom styles", () => {
const style = { boarderRadius: 10, height: 50, width: 50 };
const skeleton = mount(<Skeleton height={100} style={style} />);
expect(skeleton.find(skeletonSelector).prop("style")).toEqual({
...style,
height: 100,
});
});
it("should render custom className if provided", () => {
const skeleton = mount(<Skeleton count={4} className="testClass" />);
expect(skeleton.find(skeletonSelector).at(0).hasClass("testClass")).toBe(
true
);
});

@@ -39,3 +39,5 @@ import React from "react";

height,
circle
circle,
style: customStyle,
className: customClassName,
}) {

@@ -59,6 +61,11 @@ const elements = [];

let className = "react-loading-skeleton";
if (customClassName) {
className += " " + customClassName;
}
elements.push(
<span
key={i}
className="react-loading-skeleton"
className={className}
css={css`

@@ -68,3 +75,6 @@ ${skeletonStyles}

`}
style={style}
style={{
...customStyle,
...style,
}}
>

@@ -96,3 +106,3 @@ &zwnj;

height: null,
circle: false
circle: false,
};

@@ -15,3 +15,3 @@ import React from "react";

marginBottom: 10,
width: 100
width: 100,
}}

@@ -54,3 +54,3 @@ >

const handleToggle = () => {
setTheme(oldTheme => (oldTheme === "light" ? "dark" : "light"));
setTheme((oldTheme) => (oldTheme === "light" ? "dark" : "light"));
};

@@ -104,3 +104,9 @@

))
.add("Skeleton displayed as circle", () => (
.add("with custom styles", () => (
<Skeleton
height="100px"
style={{ boarderRadius: 10, height: 50, width: 50 }}
/>
))
.add("as circle", () => (
<div style={{ display: "flex", flexDirection: "column" }}>

@@ -107,0 +113,0 @@ <Skeleton count={1} height={50} width={50} circle={true} />

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc