Looking to style a child div within a parent div that toggles classes based on a flag. The parent div can have either the .pricing-section
or .new-pricing-section
class.
Here's the structure of the parent div:
const togglePriceSection = isPricingDetailsFeatureEnabled ? "new-pricing-section" : "pricing-section";
<div className={togglePriceSection}>
<div className="btn btn-link btn-icon show-more-link" onClick={() => setExpanded(!expanded )}>
{pricesList.length > 6 && !expanded ? "Show More" : expanded ? "Show Less" :null}
</div>
</div>
The goal is to apply CSS to the div with the btn
class. Attempted styling like this:
.pricing-section, .new-pricing-section .btn.btn-link.show-more-link {
text-transform: none;
margin-left: auto;
}
However, these styles are only being applied when the parent div has the
className=".new-pricing-section"
, not with className=".pricing-section"
. How can this be resolved?