-
-
Notifications
You must be signed in to change notification settings - Fork 80
Refactor of Scoped CSS #413
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
base: master
Are you sure you want to change the base?
Conversation
width: 125px; | ||
} | ||
|
||
img { |
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.
This might be "dangerous" as it now targets every "img" whereas it was scoped to the component before. so probably you want something like actions-img or so?
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.
Understood, gonna check that issue
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.
Currently the bUnit tests are red, as you "renamed" the CSS selectors
So I rename it back to the original or update the bUnit tests? |
I would do the latter |
Removed the empty razor css files and added one that I missed. An issue that remains is at home, the introduction hasn't show up yet of |
Hmm that might be because of |
There are some smaller tests that refer to the "old" structure: var items = cut.FindAll(".profile-keypoints li"); |
Based on dev tools the profiles images are loaded correctly but don't show up on the page How it works: Another bug is with PreviewImageRazor for blogposts that takes over the entire space and locks The css is @if (string.IsNullOrEmpty(PreviewImageUrlFallback))
{
<img src="@PreviewImageUrl" alt="Preview image blogpost" loading="@LazyLoadTag" decoding="@DecodingTag" />
}
else
{
<picture>
<source srcset="@PreviewImageUrl" type="@GetMimeType()"/>
<img src="@PreviewImageUrlFallback" alt="Preview image blogpost" loading="@LazyLoadTag" decoding="@DecodingTag" />
</picture>
} |
Do you need me to update them and search for other CSS renames too? |
About this portion of the issue with PreviewImage.razor I did progress adding .img-container {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
.comp-img {
position: absolute;
top: 0;
left: 0;
object-fit: cover;
height: 100%;
width: 100%;
} For <div class="img-container">
<img class="comp-img" src="@PreviewImageUrl" alt="Preview image blogpost" loading="@LazyLoadTag" decoding="@DecodingTag" />
</div> For <div class="img-container">
<picture>
<source srcset="@PreviewImageUrl" type="@GetMimeType()" />
<img class="comp-img" src="@PreviewImageUrlFallback" alt="Preview image blogpost" loading="@LazyLoadTag" decoding="@DecodingTag" />
</picture>
</div> but for some reason now stopped working haha the PreviewImageUrl too |
We have to make the tests work in one way or another. In this regard, the selector has to be aligned to the new "prefix" added. |
I have to checkout the branch later locally. I tried inside GitHub Codespaces and I got some 404 for the images. Not sure if this is because of GitHub Codespace or it showcases the underlying issue on why the images aren't showing up. |
@EliasMasche I took the opportunity to push to your PR. Hope you don't mind. |
Yeah, no problem. the only issue that remains is the home/introduction CSS, right? |
Technically, yes. So of course everything should work as before, but overall I would like to go a step further, otherwise we just moved the CSS from one file to another. Ideally:
|
The navbar items seem a bit closer than they were before and lost their "bold" font. |
Should also be fixed. Now the interesting part starts: Consolidating :D |
Roger that. I checked your commits. I pulled into my local branch, and the CSS works now, but I am getting a 404 for the images.
The end goal is to put all CSS into
Good thing this time I put the PR as draft as it is more of a proposal and WIP. |
Interesting. By any chance, do you have a chrome based browser to cross-check if it happens there as well?
No worries - that is part of the process. Issues/PR's are async in nature and therefore are more likely to have misunderstandings and whatnot. |
Yeah, same issue coming from Edge Browser, What it dislikes is that it comes from the same application but a different domain or locally triggering CORS if I use it from another website/domain, or blob storage works fine. |
Hello there, sorry ( but may not be sorry) for the disappearance. I got relocated to a new team, a new project with an impossible deadline, so I wasn't able to work. So now I pushed a new commit, redoing the rename of a class of CSS as it wasn't necessary, I believed they had the same name, I put them all inside A question about the bootstrap, this sentence: Where can I find more information, or is it referring to the internal CSS classes of Bootstrap 5 |
Hey hey - don't worry. OSS has to make space for other priorities so I totally get that and there is no need to apologize.
Sometimes I added stuff like Or grid/flex layout can be solely described via Bootstrap's utility classes. There was often no need to create custom CSS. |
I started making some changes to Bootstrap. What is the plan? Besides, in this commit based on bootstrap, there are two ways to keep the custom class or use an inline. Checking through the repo, this is the only instance, so I guess using an inline CSS is fine And I am already triggering some fails in tests because the HTML classes are missing in the razor files. For the moment, I am working on replacing them with Bootstrap but keeping the custom classes in |
I am not sure if I understand correct? What do you mean by that?
If we keep stuff then still as classes. That is fine. If we see a chance to remove the custom CSS, that would be great, if not - then let's keep it as it is.
Why would we need them as fallback? Sure, the tests have to be adopted and that is unfortunately a bit of a shortcoming on the current test-setup that it uses too much the concrete CSS classes. But that is a whole different story :D so for now it might be the best, to change failing ones to the new classes to it still targets the same object. |
You replied this question in the second, I was asking or trying to ask if I should refactor until it is done or not possible to do it.
Sorry, what I mean is I still keep the old custom CSS classes for the time being for testing if the new HTML bootstrap CSS classes are working properly. Once I finish, I will do the cleaning. I am keeping a list of the custom CSS classes and commenting as I progress with the refactor |
I did some progress overall, trying to match or mimic the appearance from custom CSS classes with Bootstrap 5 and with that able to reduce LoS in There is this new warning:
About the tests, how is gonna be the progress going to be? |
Sorry for the late answer - I try to find some time next week for this and give you a proper answer to your questions |
No problemo, as you once wrote, there is time for open-source, sometimes must side step for other priorities. At least I know still alive the process ^^ |
It seems that I closed the PR by accident when I replied because I don't remember doing it. I pushed new commits based last version, refactoring the A summary of what css it keeps:
|
{ | ||
<div draggable="true" @ondrag="@(() => currentDragItem = skill)" style="cursor: grab" | ||
class="skill-tag"> |
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.
For example this is why some of the tests are failing.
There is a test looking for .skill-tag
inside tests.
So we have two options:
- Add again
.skill-tag
here without the backing razor.css (kind of just as a marker) - Or replace
skill-tag
with d-inline-block me-2 my-2 px-2 py-1 rounded bg-light`
I would go for the first approach - as it makes the tests more readable
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.
I prefer first approach too, gonna check the unit tests for others more.
Also checked out your version locally - it is in a good shape. There are some noticeable differences (some we have to flatten out) to the current state. |
Roger that, if you find some differences, tell me so I can fix them, I noted some of the differences that I listed them probably are more |
Returning to this issue, I notice a different behavior from CSS when it is relocated from I created this new branch to test. The only changes were moving all razor CSS to basics.css as is, and they get replicated these 3 different behaviors at the UI from CSS https://github.com/EliasMasche/Blog/tree/refact ![]() With the padding or spacing of NavBarMenu buttons to look closer at the old appearance, is using |
Hey @EliasMasche thanks for the hard work and reminding me to answer. I am currently overwhelmed with other tasks and can't really put much time into this. feel free to continue, but it might take a while until I can answer properly |
Hey @EliasMasche - sorry for the long pause. Given all the "issues" we discovered with the approach of moving it into central files - is it really worth the effort if it might break left and right? |
Hello there, @linkdotnet is fine, I wasn't able to check much either through the month because I was dealing with the curves that life has been throwing me. About the question of worth, I think it is fine as is and will not break anymore; only these three issues remain: ![]() About 1. and 2. tried to fix, but weren't able to identify which CSS code or line is breaking the appearance. A detail of issue 2. is that the code is double-drawing the box, so probably rewrite or revamp with a new appearance
The rest of CSS code got relocated to the central CSS This week I was gonna resume and verify what I could do or remake the CSS, but I didn't know what or how to progress |
@@ -5,7 +5,7 @@ | |||
@implements IDisposable | |||
|
|||
<nav class="navbar navbar-expand-lg navbar-light w-100"> | |||
<div class="container-fluid"> | |||
<div class="container-fluid" style="--bs-navbar-nav-link-padding-x: 1rem;"> |
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.
I think if we have to explicitly overwrite the bootstrap style, we are better off setting it into a custom class with higher specificity. Otherwise a minor update of bootstrap and the solution breaks
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.
Placing at#navbarSupportedContent
and .nav-link
the custom class for handling the padding is gonna be enough for avoiding that situation of breaking at updates?
#navbarSupportedContent .nav-link {
padding-left: 1rem;
padding-right: 1rem;
}
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.
Padding-left and right would be "px-3" so you could just add that.
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.
Aka: We can stay in the bootstrap world
@EliasMasche if something isn't visually working, we can also rollback part of the changes have the *.razor.css - that is no problem. ALso if you feel that things is somewhat ready, you can press the button ;) |
@linkdotnet, the remaining behavior visually that differs is at the box padding of the SkillTag, I believe, but only when you are logged in. Logged out, visits work properly. Do I rollback that CSS code, or keep it as is, and everything else is ready, so I press that button |
Okay - I would prefer if we rollback the changes then. |
Reverted to the razor.css file. Regarding the merge conflict, I leave it in your hands, or I will check. |
Initial PR of the process for Scoped CSS