From a0a4bd95f25f7c6864613e74ff1c38ef8e3a6d39 Mon Sep 17 00:00:00 2001 From: rishav-jha-mech Date: Thu, 1 Jun 2023 00:27:45 +0530 Subject: [PATCH] Updated CODE_STYLE.md --- CODE_STYLE.md | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/CODE_STYLE.md b/CODE_STYLE.md index 2057693c0a..c1dbd52dee 100644 --- a/CODE_STYLE.md +++ b/CODE_STYLE.md @@ -38,7 +38,67 @@ code style should not be changed and must be followed. - All the Return fragment should be closed in empty tag -- Use of classes is refrained +- Use of custom classes directly are refrained, use of modular css is encouraged along with bootstrap classes + +**Wrong way ❌** +``` +
...
+
...
// No using personal custom classes directly, here you should not use myCustomClass2 +.container{...} // No changing the property of already existing classes reserved by boostrap directly in css files +``` + +**Correct ways ✅** +``` +
...
// Use custom class defined in modular css file +
...
// Use classes already defined in Bootstrap +
...
// Use classes already defined in Bootstrap +``` + +- All components should be either imported from React-Bootstrap library or Material UI library, components should not be written using plain Bootstrap classes and attributes without leveraging the React-Bootstrap library. + +**Example: Bootstrap Dropdown** + +**Wrong way ❌** + +Using plain Bootstrap classes and attributes without leveraging the React-Bootstrap library should be refrained. While it may work for basic functionality, it doesn't fully integrate with React and may cause issues when dealing with more complex state management or component interactions. +``` + +``` + + +**Correct way ✅** + +It's recommended to use the React-Bootstrap library for seamless integration of Bootstrap components in a React application. +``` +import Dropdown from 'react-bootstrap/Dropdown'; + +function BasicExample() { + return ( + + + Dropdown Button + + + + Action + Another action + Something else + + + ); +} + +export default BasicExample; +``` ## Test and Code Linting