Fork me on GitHub
#lambdaisland
<
2023-05-22
>
donavan22:05:06

Hi all, thanks for the cool library (ornament), it really does allow for some neat and tidy component ‘inheritance’ (for lack of a better word). I’ve been noodling about with namespaced Girouette rules as I have a bunch of rules that are only used in one context, say ‘hover’ but for menu items or ‘hover’ for buttons and I’d like to just do something like:

(defstyled container container*
  :pointer
  ::hover)
…where the ::hover rule is defined in the current NS. In reality it’s actually something like ::hover-primary-to-secondary but that’s not important. There are a few pieces of hackery that make it work but they are all confined in how I define the rule component (i.e., in my code) but the only missing piece that I can’t hack away is https://github.com/lambdaisland/ornament/blob/main/src/lambdaisland/ornament.cljc#L288 and supporting it is not a great deal of effort (on the surface it seems that way at least!). A minimal change, for example, is something like:
(keyword? rule)
(let [rule-name (if (namespace rule)
                  (classname-for rule)
                  (name rule))
      girouette-garden (class-name->garden rule-name)])
Has this ever been considered before?

donavan22:05:05

Reading the source I realise the process-tag method works really well for my use case without needing any hackery 😆

donavan10:05:35

…but still wondering about the above question re. namespaced girouette keywords

plexus15:06:43

Hi @U0VP19K6K, this sounds interesting but I'm not 100% sure I'm following. How do you "define" ::hover?

donavan11:06:36

@U07FP7QJ0, thanks for reply 🙂 I’ll put this idea into a form (code) that’ll make it clearer for you