Thanks for the suggestion @kinetiksoft! I like to keep shared components without group features though . The reason is that in my experience the actual use cases are often more specific than just selecting a group. You might need to distinguish anonymous visitors as well. Or display different content to different groups. And then it adds complexity already.
I usually fork components or just implement different layout options with CSS. So Iām afraid this would be my recommendation as well.
With respect to targeting groups with CSS, the Discourse groups css classes in body is a great helper component.