#dev 2024-08-18

2024-08-18 UTC
bret, __earlps__, thegreekgeek_ and [snarfed] joined the channel
#
[snarfed]
interesting defense of tailwind-style utility css: https://steveklabnik.com/writing/against-names/#utility-css
#
[snarfed]
argument in a nutshell seems to be that semantic style reuse is good, but it should probably happen at the component level instead
#
[snarfed]
(I'm nowhere enough of a web dev to really evaluate that)
beanbrain, thegreekgeek, bterry and [Murray] joined the channel
#
[Murray]
Heh, and I don't understand Rust well enough to really evaluate what the point here is either πŸ˜…
#
[Murray]
Though it seems to me that this could broadly be condensed to: code style is fine, but don't get too officious about things?
#
[Murray]
But I'd agree that semantic names _at the tag level_ is a misuse of Semantic CSS, and that component-driven styles are a much simpler and easier to maintain paradigm. I just struggle to connect the dots from that statement to "utility CSS is therefore the right way to go", as that is also not component level and therefore appears contradictory 🀷
#
[Murray]
(obligatory plug for CUBE (https://cube.fyi/) if you want to see utility classes done right, imo πŸ˜‰)
thegreekgeek, GWG, barnaby, ttybitnik, Kaguneh, jonnybarnes and sp1ff joined the channel
#
Kaguneh
Hey y'all. I recently learned how to use JS cookies to store what '
#
Kaguneh
'tab' the user has most recently been on so it stays that way for refresh
#
Kaguneh
but im finding out I don't really want my site to collect cookies. Is there a way to keep the functionality without them?
#
Kaguneh
the tabs, btw, are just like switching between a list, grid, and swiper view for an album gallery I have
#
[snarfed]
Kaguneh localStorage?
#
Kaguneh
that's with jQuery right? I'll look into it.
#
Kaguneh
learning curve for this stuff has been harder than expected, sometimes I don't even know what to google. Thanks!
#
ptramo[d]
Put it in the hash of the url?
#
ptramo[d]
Like my.gallery/album/123#list
#
ptramo[d]
You can change the hash without reloading the page, and read it on page load.
#
ptramo[d]
You can do that with the path too but that's a tad harder, look at window.history (for the hash you can care about only window.location)
#
Kaguneh
oh I haven't been using window objects. Would this be a solution without having to import jQuery or anything?
#
Kaguneh
i just watched a video and it does make sense to use the hash to navigate to diff parts of the same page. I don't immediately see how it could be used to emulate tabs that hide content but I will keep googling
#
[Murray]
@Kaguneh you can use jQuery for local storage, but it isn't a requirement, and the native JavaScript APIs are pretty good these days for working with it. You can see how to set/get data from it on MDN (a lot simpler than cookies πŸ˜… ) https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
#
ptramo[d]
You don't need to import anything. No library is ever strictly required, all the base functionality is available in the platform
#
Kaguneh
Found a video for using hash navigation with native JS so am watching that rn. Closest thing I found for localStorage was a dark/light mode switcher tut which I'll try to follow and adjust
#
Kaguneh
thanks y'all
#
Kaguneh
very noob question of mine I realize
#
Kaguneh
wondering if the hash navigation method is more privacy-respecting than using localStorage?
#
Kaguneh
though I guess since it's only client-side it wouldn't matter. But I just read that if someone loads the page with cookies disabled, localStorage wouldn't work either
#
catgirlin.space
what’s the point of avoiding cookies so much?
#
[Murray]
I wouldn't say it was any more or less privacy-respecting (that's not super relevant here), but yes, it might have one less fail state in the browser. Not super sure on that though, and neither will work with JS disabed
#
[Murray]
*disabled
#
Kaguneh
Murray that makes sense. thanks for the info
#
Kaguneh
IWDiscord on my side it's probably just like vague principles about minimizing server-client data transfer if I can, and nebulous 'privacy' concerns. Obvs the usual cookie-related attack vectors are easy to handle but if I don't use them, I don't have to consider protecting myself from cookie exploits (even if it's easy)
#
Kaguneh
im not super educated on the subject tho, just paranoid. So happy to hear pushback and learn something new
#
Kaguneh
I got it working w localStorage thanks for the guidance!
AramZS and [KevinMarks] joined the channel
#
[KevinMarks]
Hash navigation can be made to do hide/show rather than scroll to
#
[KevinMarks]
You use the :target selector
AramZS_, AramZS, IWSlackGateway1 and bterry joined the channel