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
Issue: Standardizing Component Styles with CSS Variables
Objective:
Ensure that component styles in Salt are streamlined and maintainable by utilizing a minimal set of CSS declarations driven by component-specific CSS variables. This is a non-breaking refactor of existing styles and tokens that has no impact to the current consumers.
Approach:
Component-Specific CSS Variables:
Each component should define its own set of default CSS variables.
Variable names should be intuitive and user-friendly, reflecting the component's purpose rather than the system's internal naming conventions.
Naming convention: Use a prefix representing the component followed by the CSS attribute name.
Default Values:
Default values for these variables should either align with system-wide characteristics or be hard-coded to specific values.
Example - Button Styles:
.saltButton {
--button-background:var(--button-background-default);
--button-borderColor:var(--button-borderColor-default, transparent);
--button-color:var(--button-color-default, inherit);
/* Properties with contract variable support */align-items:var(--button-alignItems);
background:var(--button-background);
border-color:var(--button-borderColor);
color:var(--button-color);
/* ... other CSS declarations here *//* Other hard-coded properties */appearance: none;
box-sizing: border-box;
display: inline-flex;
position: relative;
text-decoration: none;
transition: none;
-webkit-appearance: none;
-webkit-tap-highlight-color: transparent;
}
State-Based Variable Adjustments:
Local variables should be adjusted based on component state, such as hover, active, or disabled states.
/* Pseudo-class for hover state when Button is not active or disabled */
.saltButton:hover {
--button-background: var(--button-background-hover);
--button-borderColor: var(--button-borderColor-hover);
--button-color: var(--button-color-hover);
}
By adopting this approach, we aim to create a consistent and flexible styling system that enhances maintainability and user experience across all components. The refactored styles will reduce the fragmentation of styles and provide a separation between style and tokens within the CSS file.
The text was updated successfully, but these errors were encountered:
Issue: Standardizing Component Styles with CSS Variables
Objective:
Ensure that component styles in Salt are streamlined and maintainable by utilizing a minimal set of CSS declarations driven by component-specific CSS variables. This is a non-breaking refactor of existing styles and tokens that has no impact to the current consumers.
Approach:
Component-Specific CSS Variables:
Default Values:
Example - Button Styles:
State-Based Variable Adjustments:
Local variables should be adjusted based on component state, such as hover, active, or disabled states.
Outcome:
By adopting this approach, we aim to create a consistent and flexible styling system that enhances maintainability and user experience across all components. The refactored styles will reduce the fragmentation of styles and provide a separation between style and tokens within the CSS file.
The text was updated successfully, but these errors were encountered: