Fork me on GitHub
#garden
<
2020-01-31
>
fenton20:01:35

anyone know how to write the garden clojurescript for grid-areas? in css they look like:

grid-template-areas: 
      ".  .  hd hd   hd   hd   hd   hd   ."
      "sd sd sd main main main main main main"
      "sd sd sd  ft  ft   ft   ft   ft   ft";
i tried something like:
:grid-template-areas
     [".  .  hd hd   hd   hd   hd   hd   ."
      "sd sd sd main main main main main main"
      "sd sd sd  ft  ft   ft   ft   ft   ft"]
but no dice.

noprompt20:01:47

Can you elaborate?

fenton22:01:36

well see the plain css one is three strings, terminated by a semi-colon... I'm not sure how to express three strings in clojurescript... tried putting them in a vector...but...

fenton22:01:45

I think I can just escape the double quotes like so:

[:.wrapper
    {
     :display "grid"
     :grid-template-areas 
"
     \".  .  hd hd   hd   hd   hd   hd   .\"
      \"sd sd sd main main main main main main\"
      \"sd sd sd  ft  ft   ft   ft   ft   ft\"
"
     }]

noprompt22:01:48

I see. I’m not familiar with this. Another, perhaps more robust, way to do that would be to use pr-str.

noprompt22:01:01

(defn grid-template-areas [areas]
  {:grid-template-areas (reduce str (map pr-str areas))})
where areas are the strings in the vectors you gave.

noprompt22:01:47

If you need them separated somehow you can use clojure.string/join instead of (reduce str ,,,)

fenton22:01:01

yeah, that works and looks better

(pr-str ".  .  hd hd   hd   hd   hd   hd   ."
             "sd sd sd main main main main main main"
             "sd sd sd  ft  ft   ft   ft   ft   ft")

noprompt22:01:54

Heh, I didn’t know you could pass multiple args to pr-str. 😄

fenton22:01:18

yeah, i just dropped the vector as, yeah cool right! thank you very much sir! 🙂