@ama-pt/agora-design-system 0.1.1 → 0.1.2
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/README.md +6 -277
- package/README.npm.md +6 -277
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,292 +1,21 @@
|
|
|
1
1
|
# Ágora Design System
|
|
2
2
|
|
|
3
|
-
<b>
|
|
3
|
+
<b>Bem-vindo ao Ágora Design System, o sistema de design e desenvolvimento por detrás do ePortugal o portal agregador de serviços públicos da República Portuguesa</b>
|
|
4
4
|
|
|
5
5
|
## Core technologies
|
|
6
6
|
|
|
7
|
-
- React -
|
|
8
|
-
- NextJs -
|
|
9
|
-
-
|
|
10
|
-
- Tailwindcss - version ^3.2.4 - <https://tailwindcss.com/docs/installation>
|
|
11
|
-
- Radix-UI - <https://www.radix-ui.com/docs/primitives/overview/introduction>
|
|
12
|
-
- Node - version ^16
|
|
7
|
+
- React - <https://reactjs.org/>
|
|
8
|
+
- NextJs - <https://nextjs.org/>
|
|
9
|
+
- Tailwindcss - <https://tailwindcss.com/docs/installation>
|
|
13
10
|
|
|
14
11
|
## Useful Links
|
|
15
12
|
|
|
16
13
|
- StoryBook Dev - <https://qld-portal-unico.northeurope.cloudapp.azure.com>
|
|
17
|
-
- StoryBook UX-Review - <https://dev-portal-unico.northeurope.cloudapp.azure.com:8180>
|
|
18
|
-
- Tailwind CSS Cheat Sheet - <https://tailwindcomponents.com/cheatsheet/>
|
|
19
|
-
- Sonnar - <https://ticappsonar.northeurope.cloudapp.azure.com/sonarqube/dashboard?id=portal-unico-storybook-agora>
|
|
20
|
-
- Nexus - <https://ticappsonar.northeurope.cloudapp.azure.com/nexus/#browse/browse:npm-general:%40ama%2Fagora-design-system>
|
|
21
14
|
- Figma (UX Design) - <https://www.figma.com/files/project/60863393/Ágora-Design-System>
|
|
22
15
|
- ZeroHeight - <https://zeroheight.com/1be481dc2/p/2861fa-boas-vindas>
|
|
23
|
-
- AccessMonitor (Acessibilidade AMA) - <https://accessmonitor.acessibilidade.gov.pt/>
|
|
24
|
-
- W3Validator - <https://validator.w3.org/nu/>
|
|
25
|
-
- Axe DevTools - <https://chrome.google.com/webstore/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd?utm_source=deque.com&utm_medium=referral&utm_campaign=axe_hero>
|
|
26
16
|
|
|
27
|
-
## Installation
|
|
17
|
+
## Installation
|
|
28
18
|
|
|
29
19
|
```sh
|
|
30
|
-
> npm install
|
|
31
|
-
> npm run storybook
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
This will generate logs like in the screenshot and locally launch the application
|
|
36
|
-
|
|
37
|
-

|
|
38
|
-
|
|
39
|
-
## Build project
|
|
40
|
-
|
|
41
|
-
Generating the project build helps us to understand if everything is ok and ready to a production environment. It is recommended to use this each time a component is terminated.
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
> npm run build-storybook
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Format all files with Prettier config
|
|
48
|
-
|
|
49
|
-
To keep code and commits easy to read a custom config was made to format files to everyone on the same way. We can force this format running. The formatter runs on every file and fix them.
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
> npm run format
|
|
20
|
+
> npm install @ama-pt/agora-design-system
|
|
53
21
|
```
|
|
54
|
-
|
|
55
|
-
## Check Lint and Lint fix
|
|
56
|
-
|
|
57
|
-
Using this to runs ESLint and find problems with syntax. Some we can fix with lint-fix. Others we have to make some changes.
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
> npm run lint
|
|
61
|
-
> npm run lint-fix
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
<b>NOTE: Both (Build and Lint commands) help to ensure Sonnar scan to run smoothly.</b>
|
|
65
|
-
|
|
66
|
-
## Project Structure
|
|
67
|
-
|
|
68
|
-

|
|
69
|
-
|
|
70
|
-
All additional files generated by tools and are not required to any part of the project, must be added to the **_.gitignore_** file.
|
|
71
|
-
|
|
72
|
-
### **Folder _.storybook_**
|
|
73
|
-
|
|
74
|
-

|
|
75
|
-
|
|
76
|
-
- _mains.js_ - the main reason to edit this file are to add new addons to storybook, order stories folders and add new static dirs.
|
|
77
|
-
|
|
78
|
-
- _manager-head.html_ - configure favicon of storybook app
|
|
79
|
-
|
|
80
|
-
- _manager.js_ - call our custom theme
|
|
81
|
-
|
|
82
|
-
- _preview.js_ - configure and call theme and other configurations of storybook
|
|
83
|
-
|
|
84
|
-
- _theme.js_ - custom theme, allow change logos, fonts, url of logos, etc.
|
|
85
|
-
|
|
86
|
-
### **Folder _dist_**
|
|
87
|
-
|
|
88
|
-

|
|
89
|
-
|
|
90
|
-
When run the command bellow this will generate the folders above. This folder contains building files to our future lib. We can run this to check structure but this isn't used on development only when we publish.
|
|
91
|
-
|
|
92
|
-
```sh
|
|
93
|
-
> npm run build
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### **Folder _docs_**
|
|
98
|
-
|
|
99
|
-
Contains assets to support this README file.
|
|
100
|
-
|
|
101
|
-
### **Folder _infractructure_**
|
|
102
|
-
|
|
103
|
-
Contain file for Apache configuration.
|
|
104
|
-
|
|
105
|
-
### **Folder _src_**
|
|
106
|
-
|
|
107
|
-

|
|
108
|
-
|
|
109
|
-
- _assets_ folder contains all images needed to our storybook or for some component to use. Divided on two folders:
|
|
110
|
-
|
|
111
|
-
- **_storybook_** - all images/files related with environment of storybook app
|
|
112
|
-
- **_app_** - all images/files related with components development
|
|
113
|
-
|
|
114
|
-
- _components_ folder contain main content, divided on:
|
|
115
|
-
- **_documentation_** contain a story mdx file used on welcome page
|
|
116
|
-
- **_ui_** contains the root structure for component development and files to export component and their props.
|
|
117
|
-
- **_styles_** contain a file used to global css of storybook. Specific component styling must be placed in its contextual folder. This style folder is used only for general/base purposes.
|
|
118
|
-
|
|
119
|
-
### **Tailwind.config.js** file
|
|
120
|
-
|
|
121
|
-
File support all configurations to scss based on Figma and can be written with more or edited.
|
|
122
|
-
|
|
123
|
-
## Metodology Atomic Design Principles
|
|
124
|
-
|
|
125
|
-
The component development follows the Atomic Design Principles - <https://xd.adobe.com/ideas/process/ui-design/atomic-design-principles-methodology-101/>.
|
|
126
|
-
|
|
127
|
-
To reflect this, the **src/ui** folder must respect the following practices:
|
|
128
|
-
|
|
129
|
-
- Ensure the following folder structure:
|
|
130
|
-
- Atoms
|
|
131
|
-
- Molecules
|
|
132
|
-
- Organisms
|
|
133
|
-
- Templates
|
|
134
|
-
- Pages
|
|
135
|
-
- Components:
|
|
136
|
-
- Component folders name must be written in **kebab-case** (i.e: name-othername).
|
|
137
|
-
- Component file for source code must be named must be written in **kebab-case** (i.e: name-othername.tsx).
|
|
138
|
-
- Stories:
|
|
139
|
-
|
|
140
|
-
- Story files used to write documentation must be named with the same component name with the **.stories.mdx** suffix (i.e: name-othername.stories.mdx).
|
|
141
|
-
- Story tsx files used to generate code use cases/examples must be named with the same component name with the **.stories.mdx** suffix (i.e: name-othername.stories.tsx).
|
|
142
|
-
- It is allowed and encouraged to used additional files to improve the readability of the story.
|
|
143
|
-
- Use the already written stories as a template model for the new stories.
|
|
144
|
-
|
|
145
|
-
- Scss files names must be written in **kebab-case** (i.e: name-othername.scss).
|
|
146
|
-
- Others folders can be added, like hooks, libs, utils, etc. Not forget to reference them to be exported.
|
|
147
|
-
|
|
148
|
-
- It must exist a index.ts file to export component and their props.
|
|
149
|
-
- Files must not contain any kind of hardcoded strings, numbers or any type of constant. If needed, it should be discussed with the team.
|
|
150
|
-
|
|
151
|
-
## Scss pattern
|
|
152
|
-
|
|
153
|
-
Each component start with a class named "agora-namecomponent". Try used most classes of tailwindcss and only when it's very specific use file scss of component.
|
|
154
|
-
|
|
155
|
-
There is already a base configuration that it is always evolving accordingly to the figma's spec defined by the UX Team.
|
|
156
|
-
|
|
157
|
-
## Accessibility
|
|
158
|
-
|
|
159
|
-
When developing a component or using an external one, accessibility is an important topic to look out for. All components must be tested on W3c, AccessMonitor and Axe. Storybook has plugin installed that gives info of that too.
|
|
160
|
-
|
|
161
|
-

|
|
162
|
-
|
|
163
|
-
## Project best practices
|
|
164
|
-
|
|
165
|
-
- All code, comments and documentation must be written in english;
|
|
166
|
-
- All code, comments and documentation must have the same structure and look and feel;
|
|
167
|
-
- Commented code blocks are forbidden;
|
|
168
|
-
- No logging (i.e: console.log);
|
|
169
|
-
- No hardcoded values;
|
|
170
|
-
|
|
171
|
-
## External libraries
|
|
172
|
-
|
|
173
|
-
The addoption of new external dependencies needs to be discussed and approved by the reviewers and the team.
|
|
174
|
-
Those libraries must respect:
|
|
175
|
-
|
|
176
|
-
- Respect the accessibility requirements of the project;
|
|
177
|
-
- Server Side Rendering;
|
|
178
|
-
- Performance;
|
|
179
|
-
- Size;
|
|
180
|
-
- Actively maintained;
|
|
181
|
-
|
|
182
|
-
## SonarQube
|
|
183
|
-
|
|
184
|
-
This project is connected to SonarQube.
|
|
185
|
-
SonarQube is a tool that do code quality analysis and report them. If SonarQube find some kind of issue, the pipeline fails. All SonarQube issues must be fixed in order to build a new image. Those issues must be fixed by the person (if present) that originated them.
|
|
186
|
-
|
|
187
|
-
## Git Flow Development -> Merge Request -> Review -> Approve -> Merge
|
|
188
|
-
|
|
189
|
-
- Create a feature with a suggestive name or if exist the number and name of Jira ticket (i.e: ADSDEV-999-descritive-name)
|
|
190
|
-
- After finishing the development, open a Merge Request(MR) with a sugestive name (Atencion that last comment commit normaly used as name, but not always is suggestive) and a concise description of what was develop and any question/explication of some part of code. Assign this to a Reviewer.
|
|
191
|
-
- All merge requests must be up to date with the target branch. Meaning that a new MR to development branch must be updated with all development branch changes.
|
|
192
|
-
- Any thread openned by the reviewers must only be closed by them. Any people involved in the project can comment a review thread.
|
|
193
|
-
- If all good to go, the reviewers will approve the MR. Only when all reviewers (present at the time of the review) approve the MR, it will be merged to the main development branch.
|
|
194
|
-
|
|
195
|
-
## Update dev environment of Storybook
|
|
196
|
-
|
|
197
|
-
Reviewers, as needed or when requested, can deploy new versions of the storybook project. The deployment of new versions to the dev environment requires only a new code commit (via a merge request merged to dev) and a successfull run of the deploy stage of the CI/CD pipeline.
|
|
198
|
-
|
|
199
|
-
## Prepare code to generate new version Lib
|
|
200
|
-
|
|
201
|
-
Change package.json version, commit to develop then merge to master. This will trigger a publishing stage that will publish the generated lib in nexus. See gitlab-ci.yml to more info.
|
|
202
|
-
|
|
203
|
-
## Use Lib
|
|
204
|
-
|
|
205
|
-
Is required to have user account on AMA Nexus to install this lib. Need to create a .npmrc file with registry and account settings.
|
|
206
|
-
|
|
207
|
-
```sh
|
|
208
|
-
> npm install @ama/agora-design-system
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
This lib should be used on a Next App with this config on next.config.js
|
|
212
|
-
|
|
213
|
-
```sh
|
|
214
|
-
const withTM = require('next-transpile-modules')(['@ama/agora-design-system', '@babel/preset-react']);
|
|
215
|
-
|
|
216
|
-
module.exports =
|
|
217
|
-
withTM({
|
|
218
|
-
optimizeFonts: false,
|
|
219
|
-
i18n: {
|
|
220
|
-
locales: ['pt'],
|
|
221
|
-
defaultLocale: 'pt'
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
images: {
|
|
225
|
-
disableStaticImages: true
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
devIndicators: {
|
|
229
|
-
buildActivity: false
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
output: 'standalone',
|
|
233
|
-
|
|
234
|
-
webpack(config) {
|
|
235
|
-
config.module.rules.push(
|
|
236
|
-
{
|
|
237
|
-
test: [/\.ts(x)?$/, /\.js(x)?$/],
|
|
238
|
-
use: [
|
|
239
|
-
{
|
|
240
|
-
loader: 'babel-loader',
|
|
241
|
-
options: {
|
|
242
|
-
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript']
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
],
|
|
246
|
-
exclude: /node_modules/
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
{
|
|
250
|
-
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
|
|
251
|
-
loader: require.resolve('url-loader')
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
test: /\.js.map$/,
|
|
255
|
-
enforce: 'pre',
|
|
256
|
-
use: ['source-map-loader']
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
test: /\.map$/i,
|
|
260
|
-
use: 'raw-loader'
|
|
261
|
-
}
|
|
262
|
-
);
|
|
263
|
-
return config;
|
|
264
|
-
}
|
|
265
|
-
})
|
|
266
|
-
;
|
|
267
|
-
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Environments
|
|
271
|
-
|
|
272
|
-
UX-Review - [https://dev-portal-unico.northeurope.cloudapp.azure.com:8180](https://dev-portal-unico.northeurope.cloudapp.azure.com:8180)
|
|
273
|
-
|
|
274
|
-
Dev - [https://qld-portal-unico.northeurope.cloudapp.azure.com/](https://qld-portal-unico.northeurope.cloudapp.azure.com/)
|
|
275
|
-
|
|
276
|
-
There are 2 main environments for this storybook design system project. UX-Review and Dev.
|
|
277
|
-
|
|
278
|
-
### UX-Review
|
|
279
|
-
|
|
280
|
-
This environment is used by devs and the UI-UX team to perform all the pre-validations required for any branch to be ready to assigned to a merge request.
|
|
281
|
-
|
|
282
|
-
This environment reflects only the code present in the **ux-review** branch.
|
|
283
|
-
|
|
284
|
-
**Devs** are responsible for setting up the desired code in the **ux-review** that is going to be reviewed. This environment must reflect the tasks that are ready for review by the UI-UX team.
|
|
285
|
-
|
|
286
|
-
**Maintainers** are responsible for **deploying** the code when requested. This means that devs prepare the ux-review branch, then request the Maintainers for a deploy. Maintainers announce that the environment is ready for testing.
|
|
287
|
-
|
|
288
|
-
### Dev
|
|
289
|
-
|
|
290
|
-
Dev will reflect all code in develop branch.
|
|
291
|
-
|
|
292
|
-
All merge requests approved will be merged to develop (reviewed, approved, merged), and then the Maintainers will do the deploy for the "dev environment".
|
package/README.npm.md
CHANGED
|
@@ -1,292 +1,21 @@
|
|
|
1
1
|
# Ágora Design System
|
|
2
2
|
|
|
3
|
-
<b>
|
|
3
|
+
<b>Bem-vindo ao Ágora Design System, o sistema de design e desenvolvimento por detrás do ePortugal o portal agregador de serviços públicos da República Portuguesa</b>
|
|
4
4
|
|
|
5
5
|
## Core technologies
|
|
6
6
|
|
|
7
|
-
- React -
|
|
8
|
-
- NextJs -
|
|
9
|
-
-
|
|
10
|
-
- Tailwindcss - version ^3.2.4 - <https://tailwindcss.com/docs/installation>
|
|
11
|
-
- Radix-UI - <https://www.radix-ui.com/docs/primitives/overview/introduction>
|
|
12
|
-
- Node - version ^16
|
|
7
|
+
- React - <https://reactjs.org/>
|
|
8
|
+
- NextJs - <https://nextjs.org/>
|
|
9
|
+
- Tailwindcss - <https://tailwindcss.com/docs/installation>
|
|
13
10
|
|
|
14
11
|
## Useful Links
|
|
15
12
|
|
|
16
13
|
- StoryBook Dev - <https://qld-portal-unico.northeurope.cloudapp.azure.com>
|
|
17
|
-
- StoryBook UX-Review - <https://dev-portal-unico.northeurope.cloudapp.azure.com:8180>
|
|
18
|
-
- Tailwind CSS Cheat Sheet - <https://tailwindcomponents.com/cheatsheet/>
|
|
19
|
-
- Sonnar - <https://ticappsonar.northeurope.cloudapp.azure.com/sonarqube/dashboard?id=portal-unico-storybook-agora>
|
|
20
|
-
- Nexus - <https://ticappsonar.northeurope.cloudapp.azure.com/nexus/#browse/browse:npm-general:%40ama%2Fagora-design-system>
|
|
21
14
|
- Figma (UX Design) - <https://www.figma.com/files/project/60863393/Ágora-Design-System>
|
|
22
15
|
- ZeroHeight - <https://zeroheight.com/1be481dc2/p/2861fa-boas-vindas>
|
|
23
|
-
- AccessMonitor (Acessibilidade AMA) - <https://accessmonitor.acessibilidade.gov.pt/>
|
|
24
|
-
- W3Validator - <https://validator.w3.org/nu/>
|
|
25
|
-
- Axe DevTools - <https://chrome.google.com/webstore/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd?utm_source=deque.com&utm_medium=referral&utm_campaign=axe_hero>
|
|
26
16
|
|
|
27
|
-
## Installation
|
|
17
|
+
## Installation
|
|
28
18
|
|
|
29
19
|
```sh
|
|
30
|
-
> npm install
|
|
31
|
-
> npm run storybook
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
This will generate logs like in the screenshot and locally launch the application
|
|
36
|
-
|
|
37
|
-

|
|
38
|
-
|
|
39
|
-
## Build project
|
|
40
|
-
|
|
41
|
-
Generating the project build helps us to understand if everything is ok and ready to a production environment. It is recommended to use this each time a component is terminated.
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
> npm run build-storybook
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Format all files with Prettier config
|
|
48
|
-
|
|
49
|
-
To keep code and commits easy to read a custom config was made to format files to everyone on the same way. We can force this format running. The formatter runs on every file and fix them.
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
> npm run format
|
|
20
|
+
> npm install @ama-pt/agora-design-system
|
|
53
21
|
```
|
|
54
|
-
|
|
55
|
-
## Check Lint and Lint fix
|
|
56
|
-
|
|
57
|
-
Using this to runs ESLint and find problems with syntax. Some we can fix with lint-fix. Others we have to make some changes.
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
> npm run lint
|
|
61
|
-
> npm run lint-fix
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
<b>NOTE: Both (Build and Lint commands) help to ensure Sonnar scan to run smoothly.</b>
|
|
65
|
-
|
|
66
|
-
## Project Structure
|
|
67
|
-
|
|
68
|
-

|
|
69
|
-
|
|
70
|
-
All additional files generated by tools and are not required to any part of the project, must be added to the **_.gitignore_** file.
|
|
71
|
-
|
|
72
|
-
### **Folder _.storybook_**
|
|
73
|
-
|
|
74
|
-

|
|
75
|
-
|
|
76
|
-
- _mains.js_ - the main reason to edit this file are to add new addons to storybook, order stories folders and add new static dirs.
|
|
77
|
-
|
|
78
|
-
- _manager-head.html_ - configure favicon of storybook app
|
|
79
|
-
|
|
80
|
-
- _manager.js_ - call our custom theme
|
|
81
|
-
|
|
82
|
-
- _preview.js_ - configure and call theme and other configurations of storybook
|
|
83
|
-
|
|
84
|
-
- _theme.js_ - custom theme, allow change logos, fonts, url of logos, etc.
|
|
85
|
-
|
|
86
|
-
### **Folder _dist_**
|
|
87
|
-
|
|
88
|
-

|
|
89
|
-
|
|
90
|
-
When run the command bellow this will generate the folders above. This folder contains building files to our future lib. We can run this to check structure but this isn't used on development only when we publish.
|
|
91
|
-
|
|
92
|
-
```sh
|
|
93
|
-
> npm run build
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### **Folder _docs_**
|
|
98
|
-
|
|
99
|
-
Contains assets to support this README file.
|
|
100
|
-
|
|
101
|
-
### **Folder _infractructure_**
|
|
102
|
-
|
|
103
|
-
Contain file for Apache configuration.
|
|
104
|
-
|
|
105
|
-
### **Folder _src_**
|
|
106
|
-
|
|
107
|
-

|
|
108
|
-
|
|
109
|
-
- _assets_ folder contains all images needed to our storybook or for some component to use. Divided on two folders:
|
|
110
|
-
|
|
111
|
-
- **_storybook_** - all images/files related with environment of storybook app
|
|
112
|
-
- **_app_** - all images/files related with components development
|
|
113
|
-
|
|
114
|
-
- _components_ folder contain main content, divided on:
|
|
115
|
-
- **_documentation_** contain a story mdx file used on welcome page
|
|
116
|
-
- **_ui_** contains the root structure for component development and files to export component and their props.
|
|
117
|
-
- **_styles_** contain a file used to global css of storybook. Specific component styling must be placed in its contextual folder. This style folder is used only for general/base purposes.
|
|
118
|
-
|
|
119
|
-
### **Tailwind.config.js** file
|
|
120
|
-
|
|
121
|
-
File support all configurations to scss based on Figma and can be written with more or edited.
|
|
122
|
-
|
|
123
|
-
## Metodology Atomic Design Principles
|
|
124
|
-
|
|
125
|
-
The component development follows the Atomic Design Principles - <https://xd.adobe.com/ideas/process/ui-design/atomic-design-principles-methodology-101/>.
|
|
126
|
-
|
|
127
|
-
To reflect this, the **src/ui** folder must respect the following practices:
|
|
128
|
-
|
|
129
|
-
- Ensure the following folder structure:
|
|
130
|
-
- Atoms
|
|
131
|
-
- Molecules
|
|
132
|
-
- Organisms
|
|
133
|
-
- Templates
|
|
134
|
-
- Pages
|
|
135
|
-
- Components:
|
|
136
|
-
- Component folders name must be written in **kebab-case** (i.e: name-othername).
|
|
137
|
-
- Component file for source code must be named must be written in **kebab-case** (i.e: name-othername.tsx).
|
|
138
|
-
- Stories:
|
|
139
|
-
|
|
140
|
-
- Story files used to write documentation must be named with the same component name with the **.stories.mdx** suffix (i.e: name-othername.stories.mdx).
|
|
141
|
-
- Story tsx files used to generate code use cases/examples must be named with the same component name with the **.stories.mdx** suffix (i.e: name-othername.stories.tsx).
|
|
142
|
-
- It is allowed and encouraged to used additional files to improve the readability of the story.
|
|
143
|
-
- Use the already written stories as a template model for the new stories.
|
|
144
|
-
|
|
145
|
-
- Scss files names must be written in **kebab-case** (i.e: name-othername.scss).
|
|
146
|
-
- Others folders can be added, like hooks, libs, utils, etc. Not forget to reference them to be exported.
|
|
147
|
-
|
|
148
|
-
- It must exist a index.ts file to export component and their props.
|
|
149
|
-
- Files must not contain any kind of hardcoded strings, numbers or any type of constant. If needed, it should be discussed with the team.
|
|
150
|
-
|
|
151
|
-
## Scss pattern
|
|
152
|
-
|
|
153
|
-
Each component start with a class named "agora-namecomponent". Try used most classes of tailwindcss and only when it's very specific use file scss of component.
|
|
154
|
-
|
|
155
|
-
There is already a base configuration that it is always evolving accordingly to the figma's spec defined by the UX Team.
|
|
156
|
-
|
|
157
|
-
## Accessibility
|
|
158
|
-
|
|
159
|
-
When developing a component or using an external one, accessibility is an important topic to look out for. All components must be tested on W3c, AccessMonitor and Axe. Storybook has plugin installed that gives info of that too.
|
|
160
|
-
|
|
161
|
-

|
|
162
|
-
|
|
163
|
-
## Project best practices
|
|
164
|
-
|
|
165
|
-
- All code, comments and documentation must be written in english;
|
|
166
|
-
- All code, comments and documentation must have the same structure and look and feel;
|
|
167
|
-
- Commented code blocks are forbidden;
|
|
168
|
-
- No logging (i.e: console.log);
|
|
169
|
-
- No hardcoded values;
|
|
170
|
-
|
|
171
|
-
## External libraries
|
|
172
|
-
|
|
173
|
-
The addoption of new external dependencies needs to be discussed and approved by the reviewers and the team.
|
|
174
|
-
Those libraries must respect:
|
|
175
|
-
|
|
176
|
-
- Respect the accessibility requirements of the project;
|
|
177
|
-
- Server Side Rendering;
|
|
178
|
-
- Performance;
|
|
179
|
-
- Size;
|
|
180
|
-
- Actively maintained;
|
|
181
|
-
|
|
182
|
-
## SonarQube
|
|
183
|
-
|
|
184
|
-
This project is connected to SonarQube.
|
|
185
|
-
SonarQube is a tool that do code quality analysis and report them. If SonarQube find some kind of issue, the pipeline fails. All SonarQube issues must be fixed in order to build a new image. Those issues must be fixed by the person (if present) that originated them.
|
|
186
|
-
|
|
187
|
-
## Git Flow Development -> Merge Request -> Review -> Approve -> Merge
|
|
188
|
-
|
|
189
|
-
- Create a feature with a suggestive name or if exist the number and name of Jira ticket (i.e: ADSDEV-999-descritive-name)
|
|
190
|
-
- After finishing the development, open a Merge Request(MR) with a sugestive name (Atencion that last comment commit normaly used as name, but not always is suggestive) and a concise description of what was develop and any question/explication of some part of code. Assign this to a Reviewer.
|
|
191
|
-
- All merge requests must be up to date with the target branch. Meaning that a new MR to development branch must be updated with all development branch changes.
|
|
192
|
-
- Any thread openned by the reviewers must only be closed by them. Any people involved in the project can comment a review thread.
|
|
193
|
-
- If all good to go, the reviewers will approve the MR. Only when all reviewers (present at the time of the review) approve the MR, it will be merged to the main development branch.
|
|
194
|
-
|
|
195
|
-
## Update dev environment of Storybook
|
|
196
|
-
|
|
197
|
-
Reviewers, as needed or when requested, can deploy new versions of the storybook project. The deployment of new versions to the dev environment requires only a new code commit (via a merge request merged to dev) and a successfull run of the deploy stage of the CI/CD pipeline.
|
|
198
|
-
|
|
199
|
-
## Prepare code to generate new version Lib
|
|
200
|
-
|
|
201
|
-
Change package.json version, commit to develop then merge to master. This will trigger a publishing stage that will publish the generated lib in nexus. See gitlab-ci.yml to more info.
|
|
202
|
-
|
|
203
|
-
## Use Lib
|
|
204
|
-
|
|
205
|
-
Is required to have user account on AMA Nexus to install this lib. Need to create a .npmrc file with registry and account settings.
|
|
206
|
-
|
|
207
|
-
```sh
|
|
208
|
-
> npm install @ama/agora-design-system
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
This lib should be used on a Next App with this config on next.config.js
|
|
212
|
-
|
|
213
|
-
```sh
|
|
214
|
-
const withTM = require('next-transpile-modules')(['@ama/agora-design-system', '@babel/preset-react']);
|
|
215
|
-
|
|
216
|
-
module.exports =
|
|
217
|
-
withTM({
|
|
218
|
-
optimizeFonts: false,
|
|
219
|
-
i18n: {
|
|
220
|
-
locales: ['pt'],
|
|
221
|
-
defaultLocale: 'pt'
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
images: {
|
|
225
|
-
disableStaticImages: true
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
devIndicators: {
|
|
229
|
-
buildActivity: false
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
output: 'standalone',
|
|
233
|
-
|
|
234
|
-
webpack(config) {
|
|
235
|
-
config.module.rules.push(
|
|
236
|
-
{
|
|
237
|
-
test: [/\.ts(x)?$/, /\.js(x)?$/],
|
|
238
|
-
use: [
|
|
239
|
-
{
|
|
240
|
-
loader: 'babel-loader',
|
|
241
|
-
options: {
|
|
242
|
-
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript']
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
],
|
|
246
|
-
exclude: /node_modules/
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
{
|
|
250
|
-
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
|
|
251
|
-
loader: require.resolve('url-loader')
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
test: /\.js.map$/,
|
|
255
|
-
enforce: 'pre',
|
|
256
|
-
use: ['source-map-loader']
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
test: /\.map$/i,
|
|
260
|
-
use: 'raw-loader'
|
|
261
|
-
}
|
|
262
|
-
);
|
|
263
|
-
return config;
|
|
264
|
-
}
|
|
265
|
-
})
|
|
266
|
-
;
|
|
267
|
-
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Environments
|
|
271
|
-
|
|
272
|
-
UX-Review - [https://dev-portal-unico.northeurope.cloudapp.azure.com:8180](https://dev-portal-unico.northeurope.cloudapp.azure.com:8180)
|
|
273
|
-
|
|
274
|
-
Dev - [https://qld-portal-unico.northeurope.cloudapp.azure.com/](https://qld-portal-unico.northeurope.cloudapp.azure.com/)
|
|
275
|
-
|
|
276
|
-
There are 2 main environments for this storybook design system project. UX-Review and Dev.
|
|
277
|
-
|
|
278
|
-
### UX-Review
|
|
279
|
-
|
|
280
|
-
This environment is used by devs and the UI-UX team to perform all the pre-validations required for any branch to be ready to assigned to a merge request.
|
|
281
|
-
|
|
282
|
-
This environment reflects only the code present in the **ux-review** branch.
|
|
283
|
-
|
|
284
|
-
**Devs** are responsible for setting up the desired code in the **ux-review** that is going to be reviewed. This environment must reflect the tasks that are ready for review by the UI-UX team.
|
|
285
|
-
|
|
286
|
-
**Maintainers** are responsible for **deploying** the code when requested. This means that devs prepare the ux-review branch, then request the Maintainers for a deploy. Maintainers announce that the environment is ready for testing.
|
|
287
|
-
|
|
288
|
-
### Dev
|
|
289
|
-
|
|
290
|
-
Dev will reflect all code in develop branch.
|
|
291
|
-
|
|
292
|
-
All merge requests approved will be merged to develop (reviewed, approved, merged), and then the Maintainers will do the deploy for the "dev environment".
|