Skip to content

Commit 39b589d

Browse files
committed
feat: add skeleton component
1 parent 66e413a commit 39b589d

File tree

18 files changed

+281
-3
lines changed

18 files changed

+281
-3
lines changed

docs/ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ This roadmap is our plan for building a complete front-end framework. Each item
4646

4747
## Loading & Progress
4848

49-
[ ] **Skeleton:** A placeholder that shows where things will go.
49+
[x] **Skeleton:** A placeholder that shows where things will go.
5050

5151
[ ] **Spinner:** A spinning thing to show stuff is loading.
5252

package-lock.json

Lines changed: 25 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# RCK | React Skeleton Component
2+
3+
> :warning: **WARNING**: This component library is being updated frequently and it's currently unstable due to being in it's early stages, we advice you to use only in production environments only after version **2.0.0**.
4+
5+
The Skeleton component is a versatile and adaptable element designed specifically for React applications, providing developers with a dynamic solution for displaying placeholder content while actual data is loading. This component serves as a visual representation of the content structure, giving users a sense of anticipation and engagement even before the actual data is available.
6+
7+
With the Skeleton component, developers can effortlessly create placeholders for various types of content, such as text blocks, images, or cards. Its customizable features enable developers to define the skeleton's appearance, such as background color, animation style, and spacing, ensuring seamless integration into any user interface design.
8+
9+
10+
### Installation
11+
12+
To integrate the this component into your React apps, you can install it using npm or yarn: `npm i --save @react-ck/skeleton` or `yarn add @react-ck/skeleton`.
13+
14+
You will also need to set up the theme provider, install it using npm or yarn: `npm i --save @react-ck/theme` or `yarn add @react-ck/theme`.
15+
16+
Wrap your app root with the theme provider and use this component:
17+
18+
```tsx
19+
import { ThemeProvider } from "@react-ck/theme";
20+
import { Skeleton } from "@react-ck/skeleton";
21+
22+
const myApp = () => (
23+
<ThemeProvider>
24+
<Skeleton ... />
25+
</ThemeProvider>
26+
);
27+
```
28+
29+
<!-- storybook-ignore -->
30+
31+
---
32+
33+
Check the documentation website - [react-ck.js.org](https://react-ck.js.org).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: "@react-ck/babel-config",
3+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.module.scss" {
2+
const content: Record<string, string>;
3+
export default content;
4+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Hack for module resolution of non built packages
2+
export * from "./src/index";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { config as default } from "@react-ck/jest-config";
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "@react-ck/skeleton",
3+
"private": false,
4+
"version": "1.0.0",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
7+
"files": [
8+
"/dist"
9+
],
10+
"homepage": "https://github.com/abelflopes/react-ck/tree/master/packages/components/skeleton#readme",
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/abelflopes/react-ck.git"
14+
},
15+
"scripts": {
16+
"build": "NODE_ENV=production webpack",
17+
"lint:typescript": "tsc --noEmit",
18+
"test": "npx -y npm-run-all -s test:*",
19+
"test:unit": "jest --testPathPattern=\".unit.*\"",
20+
"test:snapshot": "jest --testPathPattern=\".snapshot.*\"",
21+
"test:snapshot:update": "jest --testPathPattern=\".snapshot.*\" -u"
22+
},
23+
"devDependencies": {
24+
"@react-ck/babel-config": "^1.0.0",
25+
"@react-ck/jest-config": "^1.0.0",
26+
"@react-ck/typescript-config": "^1.0.0",
27+
"@react-ck/webpack-config": "^1.0.0",
28+
"@types/react": "^18.2.33"
29+
},
30+
"peerDependencies": {
31+
"react": "^18.2.0"
32+
},
33+
"dependencies": {
34+
"@react-ck/theme": "^1.3.1",
35+
"classnames": "^2.3.2"
36+
}
37+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Snapshot Skeleton renders correctly 1`] = `
4+
<div
5+
className="root default"
6+
style={{}}
7+
/>
8+
`;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from "react";
2+
import { Skeleton } from "../src/index";
3+
import renderer from "react-test-renderer";
4+
5+
describe("Snapshot Skeleton", () => {
6+
test("renders correctly", async () => {
7+
const tree = renderer.create(<Skeleton />).toJSON();
8+
expect(tree).toMatchSnapshot();
9+
});
10+
});

0 commit comments

Comments
 (0)