pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ClojureBA/reagent-tutorial/pull/11/files

https://github.githubassets.com/assets/github-59fc16002818df36.css" /> Add hints by nberger · Pull Request #11 · ClojureBA/reagent-tutorial · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions demo/reagentdemo/common.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
(:require [reagent.core :as r]
[reagent.debug :refer-macros [dbg println]]))

(defn demo-component [{:keys [expected comp src complete no-heading]}]
(r/with-let [showing (r/atom false)]
(defn demo-component [{:keys [expected comp src hint complete no-heading]}]
(r/with-let [showing-solution (r/atom false)
showing-hint (r/atom false)]
[:div
(when expected
[:div.demo-example.clearfix
Expand All @@ -18,16 +19,26 @@
[:h3.demo-heading "Actual output "])
(if-not complete
[:div.simple-demo [comp]]
[comp])])])
[comp])])
(when hint

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could extract these toggles into a helper component

[:div
[:a.demo-example-hide {:on-click (fn [e]
(.preventDefault e)
(swap! showing-hint not)
nil)}
(if @showing-hint "hide" "show")]
[:h3.demo-heading "Hint"]
(when @showing-hint
hint)])])

(if src
[:div.demo-source.clearfix
[:a.demo-example-hide {:on-click (fn [e]
(.preventDefault e)
(swap! showing not)
(swap! showing-solution not)
nil)}
(if @showing "hide" "show")]
(if @showing-solution "hide" "show")]
(when-not no-heading
[:h3.demo-heading "Solution"])
(when @showing src)]
(when @showing-solution src)]
[:div.clearfix])]))
9 changes: 8 additions & 1 deletion demo/reagentdemo/intro.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,16 @@
and to be fast enough by default that you rarely have to care
about performance."]

[:p "A very basic Reagent component may look something like this: "]
[:p "Vamos a empezar con un ejemplo de componente Reagent básico:"]
[demo-component {:expected simple-component
:comp solutions/simple-component
:hint [:div
[:p "Components in reagent use "
[:a {:href "https://github.com/weavejester/hiccup"}
"hiccup syntax"]
". Here's an example: "]
[:code (s/syntaxed "[:p \"I like it \" [:span {:style {:color :green}} \"green\"]]")]
[:p "Now try to write your solution on solutions/simple-component (in the file src/reagentdemo/solutions.cljs), in such a way that it looks like the example above."]]
:src (s/src-of [:simple-component])}]

[:p "You can build new components using other components as
Expand Down
2 changes: 1 addition & 1 deletion demo/reagentdemo/solutions.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[reagent.core :as r]))

(defn simple-component []
[:div "Hello!"])
[:div "Fix me in reagentdemo.solutions/simple-component"])

(defn simple-parent []
[:div "Fix me in reagentdemo.solutions/simple-parent"])
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy