Need to notice what AntD version do we used in moment when we develop this app.
"antd": "^5.20.0","antd-img-crop": "^4.21.0",
Almost in all cases we used their components. And sometimes they acts really interesting and hard. Especially when we talk about table filters. Why them? In process of development we realized that the filters for the table and the same filters that should be elsewhere could not be produced by a single component. Perhaps this is a mistake in the development itself, and perhaps a misunderstanding between the developers of this project and the developers of AntD.
Also AntD do not give us an flexible input for the phone. Because of that you need to use third-party libraries for this. Accordingly, this component sometimes does not fit well with AntD components.
Back to the table filters. Here is an example of filters from the Leads page.
AntD provides us with information how to work with these filters, but if you want to put them in another place, or even develop an option for mobile applications, then everything needs to be done through states.
It would be more logical to make one state or two and control the filters with them, but it does not work. As a result, we see a bunch of states on the same page that need to control this.
Something needs to be done using the setTimeout function. Again, for some it may be obvious things, but for some it is not. All the same, this should be mentioned since these are that certain features in our application.
More examples. Adding or reducing the number of inputs for social medias. Just look at how difficult everything is here (sorry that you need to flip through so much, a very large nesting):
It is difficult to understand all this the first time. In the code of our project you may find a lot of examples. This may be the hardest one. But this is only half the problem.
Styling
Here comes another problem. Components rarely give the opportunity to change their stylization. Some small part can be stylized using JavaScript, the rest using ordinary styles using SCSS. Other words, use the usual className's or id.
SCSS
This is where this problem manifests itself. Using this approach, we again cannot change the entire stylization.
It is necessary to change their classes to suit their own needs.
It is worth noting that certain style constants are used here. They are on the path: ...ui/src/theming/
There you will find everything you need, as well as the following:
exportconstthemeConfig= { token, components,};
Config file for AntD theme. It is used in App.js.
Look in components.js. You will find there how to customize certain styles for components. Here is part of the code from there:
exportconstcomponents= {// Here can be defined the components' styles Button: { colorPrimary:backgroundColor.Action, colorPrimaryActive:backgroundColor.ActionActive, colorPrimaryBorder:borderColor.actionPrimary, colorPrimaryHover:backgroundColor.ActionHover, colorTextLightSolid:textColor.white, borderRadius:radius.md, defaultBg:backgroundColor.white, defaultHoverBg:primitiveColors.blue100, defaultActiveBg:primitiveColors.blue200, defaultBorderColor:backgroundColor.Action, defaultColor:textColor.brandPrimary, textHoverBg:primitiveColors.blue100, colorBgTextActive:primitiveColors.blue200, colorText:textColor.brandPrimary, colorTextDisabled:primitiveColors.gray200, borderColorDisabled:'transparent', colorBgContainerDisabled:primitiveColors.gray50, colorError:backgroundColor.error, colorErrorBg:backgroundColor.error, colorErrorBgActive:primitiveColors.red700, colorErrorHover:primitiveColors.red700, colorErrorBorderHover:primitiveColors.red600, colorErrorActive:backgroundColor.errorActive, colorLink:primitiveColors.gray200, },}
N.B. By using the AntD guideline, you can adjust the stylization for yourself and your needs. It's also worth remembering that styling an app requires flexibility with which styles you should use. Use all approaches to achieve maximum results, or just one for greater code purity.
Icons
It is also worth considering which icons we use. This is Flaticon. Regular, rounded. Use search inside Flaticon documentation to find for what icon you need.
This example mean "edit" icon. We can understand it by the class name.
N.B. This is important to have all the icons inside assets. Official documents says to use regular class instead always write className.
Architecture and results
SCSS is located in the folder of each page and component, and there is also one common to all - App.scss and index.scss. Overall SCSS styles modules are in .../ui/src/common/styles/
SCSS is overwhelmingly used as modules.
JS constants are in... ui/src/theming/- if possible, use them.
Styling through props of AntD components - this will help keep the code clean.