Angular 17 App Playground tests. Using Signals and trending Angular techniques
// npm run storybook
// http://localhost:6006
yarn storybook --debug-webpack
// run Angular App
// http://localhost:4200/
ng serve -o --poll=2000
// To run some parsing test we need to mock the API
// run mock API server using Mockoon (or similar)
// use: `app/mocks/mockTranslations` with `test-ui` base url
http://localhost:3000/test-ui
// styles.scss
.global_style {
vy_extra_dark_putple: #0c0128;
vy_dark_purple: #6c56f5;
vy_light_purple: #6c56f9;
vy_light_red: #900573;
vy_dark_red: #850257;
vy_green: #606701;
vy_black: #000;
}
Created a
3x3 grid
with named areas for the: header, navigation, content, sidebar, and footer (grid-template-areas)
Created responsive layout based on:
Small Screens
(Mobile) @media (max-width: 576px),Medium Screens
(Tablets) @media (min-width: 577px) and (max-width: 1024px) andLarge Screens
(PCs) @media (min-width: 1025px) enforced with Responsive StoryBook addOns for easy visual testing
Enforced responsiveness content: usign flexible
measure units intead px
, using font-type with modernclamp()
, and (experimental)aspect-ratio:
to setup preferred aspect ratio for the container wrapper box, which will be used in the calculation of auto sizes.
Inner table scrollable
horizontally, to improve UX on smaller screens
Implemented
.browserslistrc
to ensure that yourCSS code is compatible with the browsers that you want to support
. This is a great way to ensure that you don't have to worry about browser compatibility issues. The list can be improved for this project but I wanted to start with a simple setup based on the Global Stats StatCounter (https://gs.statcounter.com/
)
Service and injector best practice: I'm keeping the component clean and dependency injection free. I'm using closure to be able to store the injected HttpClient and ActivatedRoute inside the closure scope and still use values in the returned function. Leveraging the inject() function outside the constructor phase.
The
TransactionContainer
incorporates thePaginationComponent
and binds its currentPage signal to the page model of thePaginationComponent
using the banana-in-a-box syntax ([(page)]="currentPage") = bidirectional synchronization between the PaginationComponent’s page signal and the TransactionContainer's currentPage signal
// Small Screens (Mobile)
+-----------+
| header |
+-----------+
| nav |
+-----------+
| CONTENT |
+-----------+
| side |
+-----------+
| footer |
+-----------+
// Medium Screens (Tablets)
+-----------+-----------+
| header | header |
+-----------+-----------+
| nav | CONTENT |
+-----------+-----------+
| side | footer |
+-----------+-----------+
// Large Screens (PCs)
+-----------+-----------+-----------+
| header | header | header |
+-----------+-----------+-----------+
| nav | CONTENT | side |
+-----------+-----------+-----------+
| footer | footer | footer |
+-----------+-----------+-----------+
Follow layered achitecture,
Smart Component and Presentational Component
are separated. Data Access is separated from the UI and Shared reusable parts will be shared across multiple parts of the application. This architecture enforcedSeparation of Concerns
,Dependency Injection
,Single Responsibility Principle
andModularisation
. I made an small concession to use a modernSignal
as a reactive construct to avoid the need of aSubject
to communicate between the components.
ChangeDetection strategy
is set OnPush. Component are detach from the detection cycle. This is a great way to improve performance and reduce the amount of work that Angular has to do. An step forward, could bezoneless
rendering. Specially, using Signal could make a perfomance impact as the application could become more smart and granullar. This strategy will encorage pure functional components that will lead to a more performant and predictable application. (TODO: implementzoneless
rendering for a fully detached)
Lazy Loading
is used to load the modules only when they are needed. This is a great way to improve performance and reduce the amount of work
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.