You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor CSS for Send Component to Enforce Strict BEM Conventions & Consistency with Stake
Background
The Send component currently uses a loosely BEM-inspired naming scheme (e.g. .operation__send, .operation__address-wrapper, etc.). However, it does not strictly follow BEM conventions. In our architecture, both Send and Stake are concrete implementations of a higher-level Operation. This means that as much of the markup as possible—along with the class names—should be identical between them for consistency and maintainability.
Goals
Strict BEM Conformance: Refactor the Send component’s CSS to strictly adhere to the block__element--modifier pattern.
Consistency Across Implementations: Ensure that shared markup and class names are consistent between Send and Stake. This allows us to treat them as variations of a high-level Operation, with shared structure and styling.
Reduce Global Overrides: Minimize the use of :global selectors and deeply nested selectors to improve maintainability and prevent naming conflicts.
Issues & Examples
Block Naming & Hierarchy
Issue: The Send component is implemented under a block called operation, but the component itself is Send. This can cause confusion when sharing markup with the Stake component.
Recommendation: Adopt the high-level operation block for shared elements. For instance, use a common class (e.g. .operation__content or .operation__body) instead of component-specific names like .operation__send.
This ensures that both components use the same class names for the same elements.
Modifier Usage
Issue: Modifiers such as .operation__send-address--invalid are used, but sometimes in combination with global selectors. This makes it harder to track what exactly is being modified.
Recommendation: Use modifiers strictly within the context of the block and avoid :global unless absolutely necessary.
This keeps the modifier closely coupled to the element it is modifying.
Global Selectors and Nesting
Issue: There is an overuse of :global selectors (e.g. for .dusk-amount__icon) and deeply nested selectors which can break the encapsulation intended by BEM.
Recommendation: Where possible, move styles into the local scope of the component. Flatten nested selectors to lower specificity and to make the BEM structure more transparent.
Shared Markup: Identify and isolate the common elements between Send and Stake. Refactor their markup to use the same BEM-based class names (e.g., .operation__address, .operation__input, .operation__review-label).
CSS Refactoring: Adjust the Send component’s CSS to enforce BEM conventions strictly. Once the changes for Send are finalized, replicate the same changes for the Stake component.
Testing: After refactoring, conduct visual regression and functional tests to ensure that the styling remains consistent and that no layout or behavior issues are introduced.
Next Steps
Review Proposed Conventions: Verify that the proposed block and element names meet our architectural goals for consistency between Send and Stake.
Refactor Send Component: Update the Send component’s markup and CSS according to the outlined recommendations.
Apply to Stake Component: Once the Send refactoring is validated, apply similar changes to the Stake component.
QA & Testing: Perform thorough testing to ensure that both components render correctly and that shared styles are applied uniformly.
The text was updated successfully, but these errors were encountered:
Refactor CSS for Send Component to Enforce Strict BEM Conventions & Consistency with Stake
Background
The Send component currently uses a loosely BEM-inspired naming scheme (e.g.
.operation__send
,.operation__address-wrapper
, etc.). However, it does not strictly follow BEM conventions. In our architecture, both Send and Stake are concrete implementations of a higher-level Operation. This means that as much of the markup as possible—along with the class names—should be identical between them for consistency and maintainability.Goals
block__element--modifier
pattern.:global
selectors and deeply nested selectors to improve maintainability and prevent naming conflicts.Issues & Examples
Block Naming & Hierarchy
operation
, but the component itself is Send. This can cause confusion when sharing markup with the Stake component.operation
block for shared elements. For instance, use a common class (e.g..operation__content
or.operation__body
) instead of component-specific names like.operation__send
.Consistent Element Naming
.operation__address-wrapper
(for the address section).review-transaction__label
and.review-transaction__value
(for the review section)operation
block so that both Send and Stake share the same markup.Modifier Usage
.operation__send-address--invalid
are used, but sometimes in combination with global selectors. This makes it harder to track what exactly is being modified.:global
unless absolutely necessary.Global Selectors and Nesting
:global
selectors (e.g. for.dusk-amount__icon
) and deeply nested selectors which can break the encapsulation intended by BEM.Implementation Notes
.operation__address
,.operation__input
,.operation__review-label
).Next Steps
The text was updated successfully, but these errors were encountered: