Skip to content

Commit c95cc8b

Browse files
committed
feat: add alert component
1 parent 648bb39 commit c95cc8b

File tree

24 files changed

+283
-8
lines changed

24 files changed

+283
-8
lines changed

docs/ROADMAP.md

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

99
[ ] **Tabs:** Sections to organize our site, like folders.
1010

11-
[ ] **Alert:** A notice to tell users important things.
11+
[x] **Alert:** A notice to tell users important things.
1212

1313
[x] **Accordion:** A way to hide or show parts of the page.
1414

package-lock.json

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# RCK | React Alert 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+
6+
The Alert component is a crucial tool in React applications, offering developers a dynamic and adaptable solution for effectively communicating important messages to users. Crafted with flexibility in mind, this component empowers developers to create visually appealing and user-friendly alerts that seamlessly blend into the overall design of their applications.
7+
8+
### Installation
9+
10+
To integrate the this component into your React apps, you can install it using npm or yarn: `npm i --save @react-ck/alert` or `yarn add @react-ck/alert`.
11+
12+
You will also need to set up the manager, install it using npm or yarn: `npm i --save @react-ck/manager` or `yarn add @react-ck/manager`.
13+
14+
Wrap your app root with the theme provider and use this component:
15+
16+
```tsx
17+
import { Manager } from "@react-ck/manager";
18+
import { Alert } from "@react-ck/alert";
19+
20+
const myApp = () => (
21+
<Manager>
22+
<Alert ... />
23+
</Manager>
24+
);
25+
```
26+
27+
<!-- storybook-ignore -->
28+
29+
---
30+
31+
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+
}

packages/components/alert/index.ts

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: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@react-ck/alert",
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/alert#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/text": "^1.2.6",
35+
"@react-ck/theme": "^1.4.1",
36+
"classnames": "^2.3.2"
37+
}
38+
}
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 { Alert } from "../src/index";
3+
import renderer from "react-test-renderer";
4+
5+
describe("Snapshot Alert", () => {
6+
test("renders correctly", async () => {
7+
const tree = renderer.create(<Alert>Alert</Alert>).toJSON();
8+
expect(tree).toMatchSnapshot();
9+
});
10+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react";
2+
import { Alert } from "../src/index";
3+
import { render, screen } from "@testing-library/react";
4+
import "@testing-library/jest-dom";
5+
6+
describe("Unit Alert", () => {
7+
test("renders correctly", async () => {
8+
const content = "Alert";
9+
render(<Alert>{content}</Alert>);
10+
const find = await screen.findByText(content);
11+
expect(find).toBeInTheDocument();
12+
});
13+
});

0 commit comments

Comments
 (0)