diff --git a/src/main.imba b/src/main.imba index 7bdbec1..b9cd1e0 100644 --- a/src/main.imba +++ b/src/main.imba @@ -45,7 +45,8 @@ tag param-preview tag imba-code < pre prop file prop url - css + css + &.no-code code.content p:0 code d:block bd:0 rd:0 bgc:gray8 &.file bgc:amber3 &.content c:gray3 @@ -98,9 +99,25 @@ tag pro-tip <[c:violet7 fw:bold txs:amber4 bdb:1.5px solid violet4]> "PRO TIP: " +global def Goto(target) + R.go(location.href) + target.scrollIntoView! + +global css + .c-list + bgc:yellow1 py:30px mb:60px w:fit-content + li pr: 35px + li@hover cursor:pointer + ul fw:bold + li li fw:normal c:blue6 + li li@hover c:blue4 + +tag content-list < ul + + import './views/home.imba' import './views/installation.imba' import './views/usage.imba' -import './views/abstract.imba' +import './views/choosing-router-style.imba' imba.mount if import.meta.env.MODE is 'development' \ No newline at end of file diff --git a/src/views.json b/src/views.json index a89f9cd..a814a76 100644 --- a/src/views.json +++ b/src/views.json @@ -1 +1 @@ -["home","installation","usage","abstract"] \ No newline at end of file +["home","installation","usage","choosing-router-style"] \ No newline at end of file diff --git a/src/views/abstract.imba b/src/views/abstract.imba deleted file mode 100644 index 07364ab..0000000 --- a/src/views/abstract.imba +++ /dev/null @@ -1,2 +0,0 @@ -tag view-abstract - 11 \ No newline at end of file diff --git a/src/views/choosing-router-style.imba b/src/views/choosing-router-style.imba new file mode 100644 index 0000000..a419d3f --- /dev/null +++ b/src/views/choosing-router-style.imba @@ -0,0 +1,52 @@ +tag view-choosing-router-style + + "Few words about different use cases of different routing styles." +
+ "In fact all of these can be used together in one application." +
+ + "Routing styles" +
  • +
  • 'URL based' +
  • 'Hash based' +
  • 'URL + Hash' +
  • 'URL variables based' + + "URL based router" + + "This is standard way of routing and requires that you have a router on the server side also. + Browser while approaching application will always send full URL to the server. + This is useful when you want to do SSR (server side rendering). SSR is needed for bots only (like Google, Facebook etc.). + So use it for these parts of application which are public and you want them to be crawlable/readable for bots." + "Hash based router" + + "Hash is meant for browser only. This way of routing doesn't require server at all. + Very good for decreasing unnecessary request. + Use it for dashboards and other functionalities which are not meant to be shown for anonymous user." +
    +
    + "Another use case is making standalone application which you can access even without internet - receive and + copy further. In other words save to disk like 25y ago. Good for making tool applications - processing + information which is mostly delivered by the user." +
    +
    + "For the same reason it's good for interfaces of distributed applications." + + "If you will treat Hash as only store of data for your application your application already is distributed and trully serverless. Just compile it to one html file." + + "URL and hash together" + + "Good idea is to mix both mentioned approaches together - and attach hash router to your standard application. + In hash you can store information which is tighted to the client. For example interface configuration customised by the user." + + "There's no conflict between url and hash - so you could use imba router for url and pro-router for hash." + + "Url variables based router*" + + "URL variables are old standard which is going out of common use - considered ugly to read. Still the good thing is + it's widely supported. It's supported by browsers and backends. It's great oportunity. You could use it in many ways. + For example copy values from URL to your API requests. This would give easy way (for authorised only) to modify behaviour of your backend. + Helpful for testing, debugging or switching feature flags." +
    +
    + "* - surely coming soon in pro-router2" \ No newline at end of file diff --git a/src/views/usage.imba b/src/views/usage.imba index 9a4008e..f68602a 100644 --- a/src/views/usage.imba +++ b/src/views/usage.imba @@ -1,30 +1,14 @@ -def goto(target) - R.go(location.href) - target.scrollIntoView! - -global css - .c-list - bgc:yellow1 py:30px mb:60px w:fit-content - li pr: 35px - li@hover cursor:pointer - ul fw:bold - li li fw:normal c:blue6 - li li@hover c:blue4 - -tag content-list < ul - - tag view-usage -
    • 'Components' -
    • 'ref' -
    • 'toggle' -
    • 'router' -
      • 'Pro-router tips' -
      • 'R.param' -
      • 'R.write' -
      • 'Setters and getters' +
        • 'Components' +
        • 'ref' +
        • 'toggle' +
        • 'router' +
          • 'Pro-router tips' +
          • 'R.param' +
          • 'R.write' +
          • 'Setters and getters' "Components" "This integration provides " 3