-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[template/angular-xmcloud] Fix SXA component styles for basic site #1910
Conversation
@@ -4,5 +4,22 @@ import { SxaComponent } from '../sxa.component'; | |||
@Component({ | |||
selector: 'app-promo', | |||
templateUrl: './promo.component.html', | |||
styles: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a separate SCSS file to store the styles?
import { Field } from '@sitecore-jss/sitecore-jss-angular'; | ||
import { SxaComponent } from '../sxa.component'; | ||
|
||
@Component({ | ||
selector: 'app-richtext', | ||
templateUrl: './richtext.component.html', | ||
styles: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above regarding SCSS file
import { Field } from '@sitecore-jss/sitecore-jss-angular'; | ||
import { SxaComponent } from '../sxa.component'; | ||
|
||
@Component({ | ||
selector: 'app-richtext', | ||
templateUrl: './richtext.component.html', | ||
styles: [ | ||
` | ||
:host(.footer-richtext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inside all of these styles I see a lot of "magic" numbers
e.g. "width: 17%", "nth-child(2)", "max-width: 992px"
to me it means that here is kind of "hack" applied to this component, so the solution is not reliable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can explore using attribute selectors for components instead type selectors? that could possibly remove the additional markup generated by angular
let parent = this.el.nativeElement.parentElement; | ||
|
||
while (parent) { | ||
if (parent.id === 'footer') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use such condition and rely on specific parent component
it's a "hack", what will happen if id of the parent element is changed but it's actually the same "footer" placeholder?
Description / Motivation
Testing Details
Types of changes