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
// Possible data attributes for button component: data-size, data-block, data-no-visuals
71
70
constsize=props.size&&props.size!=='medium' ? `[data-size="${props.size}"]` : ''// medium is a default size therefore it doesn't have a data attribute that used for styling
// We need to make sure we add the data attributes to the base css class (& -> &[data-attributename="value"]]) otherwise sx styles are applied due to data attribute has more specificity than class selector
// Possible data attributes for children of button component: data-component="leadingVisual", data-component="trailingVisual", data-component="trailingAction"
79
83
// When sx is used in the parent button component, these styles aren't applied to its children (leadingIcon, trailingIcon, trailingAction)
80
84
// Because sx only applies to the base selector which is "&", but we want it to be applied to '& [data-component="leadingVisual"]'
// @ts-ignore - We are sure that color exists in providedSx
91
+
const{color}=providedSx
92
+
if(!color)returncustomSxProp
93
+
for(constselectorofcssSelectorList){
94
+
customSxProp[selector]={color}// We only want to apply the color to the children of button component, because it is the one that we are overriding with data attributes that has more specificity than the parent button component.
0 commit comments