git.fiddlerwoaroof.com
Browse code

Finish site

Ed Langley authored on 19/06/2017 22:39:36
Showing 4 changed files
... ...
@@ -1 +1,2 @@
1
-To compile this site, you need DrRacket and then you just run `raco pkg install pollen && raco pollen render` from this directory
1
+To compile this site, you need DrRacket and then you just run `raco pkg install
2
+pollen && raco pollen render from this directory
... ...
@@ -1,32 +1,3 @@
1 1
 * {
2 2
     box-sizing: border-box;
3 3
 }
4
-
5
-nav#pagewise {
6
-    position: relative;
7
-    width: 100%;
8
-}
9
-
10
-#prev-page, #next-page {
11
-    position: absolute;
12
-    width: 48%;
13
-    z-index: 10000;
14
-}
15
-
16
-#prev-page::after {
17
-    content: "|";
18
-}
19
-
20
-#prev-page {
21
-    left: 0;
22
-    text-align: left;
23
-}
24
-
25
-#next-page {
26
-    right: 0;
27
-    text-align: right;
28
-}
29
-
30
-article {
31
-    position: relative;
32
-}
... ...
@@ -63,7 +63,10 @@ match.  Exact matches are always preferred to wildcards moving from left to righ
63 63
   '/user/me/:view',
64 64
   '/user/:id/update', // less specific because 'me' is exact match, while :id is a wildcard
65 65
   '/user/:id/:view'
66
-];</code></pre></section><section><h2>Fragment component</h2><pre><code class="javascript"><p>const state = {
66
+];</code></pre></section><section><h2>Fragment component</h2><p>Given that every UI state will be in your state tree as a function of
67
+your reducer logic, you can express any restriction on which parts of
68
+the UI display, even those that have nothing to do with the specific
69
+transformations caused by your URL actions.</p><pre><code class="javascript"><p>const state = {
67 70
   menu: ...
68 71
 }</p><p>const view = (
69 72
   &lt;PageFrame&gt;
... ...
@@ -91,9 +94,15 @@ const view = (
91 94
 (
92 95
   &lt;PageFrame&gt;
93 96
   &lt;/PageFrame&gt;
94
-)</p></code></pre><p>Given that every UI state will be in your state tree as a function of your reducer logic, you can express any restriction
95
-on which parts of the UI display, even those that have nothing to do with the specific transformations caused by
96
-your URL actions.</p><p>We have a demo codebase at <a href="https://github.com/cjdev/routedux-docs-demo">demo repository</a>.</p></section></section>
97
+)</p></code></pre></section><section><h2>ActionLink and pathForAction(action)</h2><p>Occasionally it is nice to render URLs inside of your application.</p><p>As a convenience, we have attached <code class="javascript">pathForAction</code> to the  <code class="javascript">store</code>
98
+object, which uses the same matcher that the action matcher uses.  This allows you to create links in your application
99
+by using the actions.</p><pre><code class="javascript"><p>const routesConfig = [
100
+  ['/user/:id', LOAD_USER, {}],
101
+  ['/user/me', LOAD_USER, {id: currentUserId()}]
102
+];
103
+// ... do store initialization</p><p>store.pathForAction({type:LOAD_USER, id: currentUserId()});</p><p>// returns /user/me</p><p>//  ActionLink</p><p>&lt;ActionLink action={{type:LOAD_USER, id: 123}}&gt;Link Text&lt;/ActionLink&gt;
104
+// renders as &lt;a href="/user/123"&gt;Link Text&lt;/a&gt;</p></code></pre></section><p>Now you have links, but your links always stay up to date with your
105
+routing configuration.</p><section><h2>Demo Site</h2><p>We have a demo codebase at <a href="https://github.com/cjdev/routedux-docs-demo">demo repository</a>.</p></section></section>
97 106
 </root>
98 107
     </article>
99 108
     <script>hljs.initHighlightingOnLoad();</script>
... ...
@@ -103,6 +103,11 @@ const routesInOrderOfPrecedence = [
103 103
 }
104 104
 
105 105
 ◊section[#:headline "Fragment component"]{
106
+Given that every UI state will be in your state tree as a function of
107
+your reducer logic, you can express any restriction on which parts of
108
+the UI display, even those that have nothing to do with the specific
109
+transformations caused by your URL actions.
110
+
106 111
 ◊pre{
107 112
 ◊code[#:class "javascript"]{
108 113
 const state = {
... ...
@@ -145,10 +150,6 @@ const view = (
145 150
   </PageFrame>
146 151
 )
147 152
 }}
148
-
149
-Given that every UI state will be in your state tree as a function of your reducer logic, you can express any restriction
150
-on which parts of the UI display, even those that have nothing to do with the specific transformations caused by
151
-your URL actions.
152 153
 }
153 154
 
154 155
 ◊section[#:headline "ActionLink and pathForAction(action)"]{
... ...
@@ -166,7 +167,9 @@ const routesConfig = [
166 167
 ];
167 168
 // ... do store initialization
168 169
 
169
-store.pathForAction({type:LOAD_USER, id: currentUserId()}); // returns /user/me
170
+store.pathForAction({type:LOAD_USER, id: currentUserId()});
171
+
172
+// returns /user/me
170 173
 
171 174
 //  ActionLink
172 175
 
... ...
@@ -175,6 +178,9 @@ store.pathForAction({type:LOAD_USER, id: currentUserId()}); // returns /user/me
175 178
 }}
176 179
 }
177 180
 
181
+Now you have links, but your links always stay up to date with your
182
+routing configuration.
183
+
178 184
 ◊section[#:headline "Demo Site"]{
179 185
 We have a demo codebase at ◊a[#:href "https://github.com/cjdev/routedux-docs-demo"]{demo repository}.
180 186
 }