@nimbus-ds/components 5.8.0-rc.20 โ†’ 5.8.0-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/README.md DELETED
@@ -1,235 +0,0 @@
1
- # `@nimbus-ds/components`
2
-
3
- [![@nimbus-ds/components](https://img.shields.io/npm/v/@nimbus-ds/components?label=%40nimbus-ds%2Fcomponents)](https://www.npmjs.com/package/@nimbus-ds/components)
4
-
5
- Nimbus components is a component library built with [React](https://reactjs.org), designed to help our teams and ecosystem build better products for our merchants.
6
-
7
- ## ๐Ÿš€ Getting started
8
-
9
- Install `@nimbus-ds/components` using any package manager.
10
-
11
- ```sh
12
- $ yarn add @nimbus-ds/components
13
- # or
14
- $ npm install @nimbus-ds/components
15
- ```
16
-
17
- ## ๐Ÿ’ป Usage
18
-
19
- ```jsx
20
- import { Button } from "@nimbus-ds/components";
21
-
22
- const ComponentExample = () => <Button>Hello World</Button>;
23
- ```
24
-
25
- For more information about our components, check out our [Storybook](https://tiendanube.github.io/nimbus-design-system/).
26
-
27
- ### Folder & file structures ๐Ÿ“ ๐Ÿ“„
28
-
29
- - For best practices in structure files please read this [document](https://redux.js.org/style-guide/style-guide#structure-files-as-feature-folders-with-single-file-logic)
30
- - When creating a new component, do so inside the **src/atomic** or **src/composite** directory
31
-
32
- ```
33
- โ”œโ”€ ๐Ÿ“ src
34
- โ”‚ โ””โ”€ ๐Ÿ“ atomic/composite
35
- ```
36
-
37
- - Every directory must contain a ๐Ÿ“„ **CHANGELOG.md** which serves to document all changes and changes made to each component.
38
-
39
- ```
40
- โ”œโ”€ ๐Ÿ“ src
41
- โ”‚ โ”œโ”€ ๐Ÿ“ atomic/composite
42
- โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ ComponentExample
43
- โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ src
44
- โ”‚ โ”‚ โ”‚ โ””โ”€ CHANGELOG.md
45
- ```
46
-
47
- - Every directory should contain a ๐Ÿ“„ **README.md** which serves to document the installation steps and a brief summary of each component.
48
-
49
- ```
50
- โ”œโ”€ ๐Ÿ“ src
51
- โ”‚ โ”œโ”€ ๐Ÿ“ atomic/composite
52
- โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ ComponentExample
53
- โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ src
54
- โ”‚ โ”‚ โ”‚ โ”œโ”€ CHANGELOG.md
55
- โ”‚ โ”‚ โ”‚ โ””โ”€ README.md
56
- ```
57
-
58
- - The directory should have the same name as the component. The component file should have the name of the component in Pascal Case format and the extension `.tsx`
59
-
60
- ```
61
- โ”œโ”€ ๐Ÿ“ src
62
- โ”‚ โ”œโ”€ ๐Ÿ“ atomic/composite
63
- โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ ComponentExample
64
- โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ src
65
- โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€ ComponentExample.tsx
66
- โ”‚ โ”‚ โ”‚ โ”œโ”€ CHANGELOG.md
67
- โ”‚ โ”‚ โ”‚ โ””โ”€ README.md
68
- ```
69
-
70
- - Every directory should contain a ๐Ÿ“„ **index.ts** which serves as an entry point for the module, component, utils and/or hooks.
71
-
72
- ```
73
- โ”œโ”€ ๐Ÿ“ src
74
- โ”‚ โ”œโ”€ ๐Ÿ“ atomic/composite
75
- โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ ComponentExample
76
- โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ src
77
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ index.ts
78
- โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€ ComponentExample.tsx
79
- โ”‚ โ”‚ โ”‚ โ”œโ”€ CHANGELOG.md
80
- โ”‚ โ”‚ โ”‚ โ””โ”€ README.md
81
- ```
82
-
83
- - Every component, utils and/or hooks should come with a test. The test must have the same name as the file being tested and the extension must be `.spec.tsx`
84
-
85
- ```
86
- โ”œโ”€ ๐Ÿ“ src
87
- โ”‚ โ”œโ”€ ๐Ÿ“ atomic/composite
88
- โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ ComponentExample
89
- โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ src
90
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ index.ts
91
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ ComponentExample.tsx
92
- โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€ componentExample.spec.tsx
93
- โ”‚ โ”‚ โ”‚ โ”œโ”€ CHANGELOG.md
94
- โ”‚ โ”‚ โ”‚ โ””โ”€ README.md
95
- ```
96
-
97
- - Every component must come with documentation. The documentation must have the same name as the file being documented and the extension must be `.stories.tsx`.
98
-
99
- ```
100
- โ”œโ”€ ๐Ÿ“ src
101
- โ”‚ โ”œโ”€ ๐Ÿ“ atomic/composite
102
- โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ ComponentExample
103
- โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ src
104
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ index.ts
105
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ ComponentExample.tsx
106
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ componentExample.spec.tsx
107
- โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€ componentExample.stories.tsx
108
- โ”‚ โ”‚ โ”‚ โ”œโ”€ CHANGELOG.md
109
- โ”‚ โ”‚ โ”‚ โ””โ”€ README.md
110
- ```
111
-
112
- - Every component must come with a typing. The type must have the same name as the file being documented and the extension must be `.types.tsx`.
113
-
114
- ```
115
- โ”œโ”€ ๐Ÿ“ src
116
- โ”‚ โ”œโ”€ ๐Ÿ“ atomic/composite
117
- โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ ComponentExample
118
- โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ src
119
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ index.ts
120
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ ComponentExample.tsx
121
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ componentExample.spec.tsx
122
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ componentExample.stories.tsx
123
- โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€ componentExample.types.ts
124
- โ”‚ โ”‚ โ”‚ โ”œโ”€ CHANGELOG.md
125
- โ”‚ โ”‚ โ”‚ โ””โ”€ README.md
126
- ```
127
-
128
- - If a component has one or more children components, a subdirectory **๐Ÿ“ components** must be created inside de main directory of the component.
129
-
130
- ```
131
- โ”œโ”€ ๐Ÿ“ src
132
- โ”‚ โ”œโ”€ ๐Ÿ“ atomic/composite
133
- โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ ComponentExample
134
- โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ src
135
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ components
136
- โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“ ComponentChild
137
- โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ index.ts
138
- โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ ComponentChild.tsx
139
- โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ componentChild.spec.tsx
140
- โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€ componentExample.types.ts
141
- โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€ index.ts
142
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ index.ts
143
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ ComponentExample.tsx
144
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ componentExample.spec.tsx
145
- โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ componentExample.stories.tsx
146
- โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€ componentExample.types.ts
147
- โ”‚ โ”‚ โ”‚ โ”œโ”€ CHANGELOG.md
148
- โ”‚ โ”‚ โ”‚ โ””โ”€ README.md
149
- ```
150
-
151
- ### Component coding ๐Ÿค– โŒจ๏ธ
152
-
153
- - The component should have the same name as the file using Pascal Case format. It should be declared in a Arrow Function, always typying the expected answer and making the default export at the end of the file.
154
-
155
- ```jsx
156
- // ComponentExample.tsx
157
- import React from "react";
158
-
159
- const ComponentExample: React.FC = () => <div>...</div>;
160
-
161
- export { ComponentExample };
162
- ```
163
-
164
- - If the component has props, they will be imported from the corresponding `.definitions.ts` file adding initial prefix corresponding to their type. Example interface ` ILogin`, type `TLogin`, enum `ELogin`.
165
-
166
- ```jsx
167
- // ComponentExample.tsx
168
- import React from "react";
169
- import { ComponentExampleProps } from "./componentExampleProps.types";
170
-
171
- const ComponentExample: React.FC<ComponentExampleProps> = ({
172
- title,
173
- description,
174
- }) => (
175
- <div>
176
- <h1>{title}</h1>
177
- <p>{description}</p>
178
- </div>
179
- );
180
-
181
- export { ComponentExample };
182
- ```
183
-
184
- ### Testing ๐Ÿงช๐Ÿ”ฌ
185
-
186
- - For testing best practices, please read this [document](https://kentcdodds.com/blog/common-mistakes-with-react-testing-library).
187
- - To create a test is necessary to import from the testing library both the render and the screen.
188
-
189
- ```jsx
190
- import { render, screen } from "@testing-library/react";
191
- ```
192
-
193
- - The component to be tested should also be imported.
194
-
195
- ```jsx
196
- import { render, screen } from "@testing-library/react";
197
- import { ComponentExample } from "./ComponentExample";
198
- ```
199
-
200
- - The heading of the tests must be written following the order Given-When-Then [Documentation](https://cucumber.io/docs/gherkin/reference/)
201
- - **Given** represents a precondition
202
- - **When** an action
203
- - **Then** a result or consequence of the action (user acceptance criteria).
204
- - **And** a result or consequence of other consequence (user acceptance criteria).
205
- - **But** a result which should not be possibly observable
206
-
207
- ```jsx
208
- import { render, screen } from "@testing-library/react";
209
- import { ComponentExample } from "./ComponentExample";
210
-
211
- describe("GIVEN <ComponentExample />", () => {
212
- describe("WHEN rendered", () => {
213
- it("THEN should display the correct text", () => {
214
- ...
215
- });
216
- });
217
- });
218
- ```
219
-
220
- - In this first instance, we will verify the right rendering of the component by checking the text in each of the elements.
221
-
222
- ```jsx
223
- import { render, screen } from "@testing-library/react";
224
- import { ComponentExample } from "./ComponentExample";
225
-
226
- describe("GIVEN <ComponentExample />", () => {
227
- describe("WHEN rendered", () => {
228
- it("THEN should display the correct text", () => {
229
- render(<ComponentExample title="title" description="description" />);
230
- expect(screen.getByText(/title/i)).toBeInTheDocument();
231
- expect(screen.getByText(/description/i)).toBeInTheDocument();
232
- });
233
- });
234
- });
235
- ```