mysterious-toddler-20573
02/02/2023, 12:34 PMmysterious-toddler-20573
02/02/2023, 12:35 PM.select2()
on that select on every request htmx makes. That might work if .select2()
is smart enough to not re-initialize, but it could cause issues.great-gold-37694
02/02/2023, 2:09 PMstocky-dentist-80693
02/02/2023, 2:20 PMhundreds-cartoon-20446
02/02/2023, 2:27 PMrefined-waiter-90422
02/02/2023, 2:29 PMmicroscopic-art-61410
02/02/2023, 2:35 PMgreat-gold-37694
02/02/2023, 2:36 PM<div> Stuff </div>
we write Html.div [] [Html.text "Stuff"]
and that compiles to VDom (meh).
But the nice thing about it being in Elm is you have the full power of the programming language for extracting things, so making a re-usable Button that's also extensible / override-able in terms of styling is both trivial & (as well as we can code it) correct.
With the Atomic approach it seems we get everything from my wishlist except for language integration. But in practice that means there's no semantics for overriding, like class="p0 p1 p2"
what padding is going to be applied to this element? In elm-ui it'd be p2 because there's "last on wins" semantics in terms of the class list. But in Atomic it's whichever one is last in the compiled stylesheet, which feels wrong to me?hundreds-cartoon-20446
02/02/2023, 2:59 PMclass="p-0 md:p-2 lg:p-6"
great-gold-37694
02/02/2023, 3:11 PMelm
card : Attributes msg -> Config msg -> Element msg
card overrides ({ body } as conf) =
E.column
(Border.rounded (UI.length (Size.units 0.5)) -- default styles
:: Border.shadow Style.Shadow.big
:: E.clip -- overflow: hidden
:: overrides -- If the caller provides a different border theirs will override the default defined above.
)
[ header conf
So the question is coming from the idea of "components" in the visual sense, like if I define a btn-primary
tailwind class then do border-0
will that override what's in the btn-primary
styles?
I've seen this term "layers" floating around which seems to be the solution but in practice I'd wonder "which layer should I be putting this in" maybe? Or is it relatively obvious once you get deeper into it?hundreds-cartoon-20446
02/02/2023, 3:32 PM.btn
class at all? Just compose the styles directly on the markup with TW classes). But if you do, then you can add them to any of the 3 "layers" - in this case @tailwind components;
would appear be before TW's utility classes @tailwind utilities;
, allowing the component styles you defined to be overridden.hundreds-cartoon-20446
02/02/2023, 3:34 PMhundreds-cartoon-20446
02/02/2023, 3:39 PMprimary
, secondary
etc variants in your TW config, and then compose them in your button component. E.g. <button class="text-white bg-blue-600 primary:bg-red-600 secondary:bg-gray-600 {{ priority }}">{{ title }}</button>
. Could be useful if that is a concept applicable to other components too.hundreds-cartoon-20446
02/02/2023, 3:42 PMjs
plugins: [
plugin(function({addVariant}) {
addVariant('primary', '.primary&');
addVariant('secondary', '.secondary&');
]
great-gold-37694
02/02/2023, 4:28 PMgreat-gold-37694
02/02/2023, 4:31 PMclassName
instead of class
again? Same complexities, same idiosyncratic solutions. 🤷♂️
Once you learn a thing it becomes "pretty" because it's familiar. I've seen a LOT of MVC, MVVM, MVU frameworks at this point, and they all look the same to me now 😅
Which is why I'm HERE cause Htmx is like LiveView but for the languages I like on the Backend 😅great-gold-37694
02/02/2023, 4:31 PMmysterious-toddler-20573
02/02/2023, 4:39 PMbumpy-kangaroo-60192
02/02/2023, 5:03 PMgreat-gold-37694
02/02/2023, 6:11 PM<div />
no JSON, no schemas, no marshalling { "name": dbName }
just good ol' HTM~~L~~Xgreat-gold-37694
02/02/2023, 6:13 PMgreat-gold-37694
02/02/2023, 6:13 PMbusy-tomato-43957
02/02/2023, 9:18 PMbumpy-kangaroo-60192
02/02/2023, 10:20 PMmysterious-toddler-20573
02/02/2023, 10:25 PMripe-action-67367
02/02/2023, 10:26 PMrich-traffic-81552
02/03/2023, 12:10 AMhtml
<div hx-get="/asdf" hx-swap="outerHTML">
<div>
Some content
</div>
<div id="inner">
<input data-awful-component-that-cannot-be-swapped />
</div>
<div>
Some other content
</div>
</div>
Is there a way to not swap #inner
? I tried hx-preserve
but it didn't seem to do anything. Currently solution is to change the top div to hx-swap="non"
and return hx-swap-oob
divs for the content that should update but it's a little unsatisfyingmysterious-toddler-20573
02/03/2023, 12:11 AMmysterious-toddler-20573
02/03/2023, 12:11 AM