Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
H
Hello Gargan
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • arturo
  • Hello Gargan
  • Wiki
    • 2—components
  • 2.2—Page and Layout structure

2.2—Page and Layout structure

Last edited by arturo Jun 14, 2021
Page history

These components respect the exact structure we saw earlier. However, they are prone to an implicit implementation, such as:

  • determined variable names: each module has to export a certain amount of attended variables
  • page / layout: refering to the component specs we have seen before
  • premount: Aff monad runned before the page first mount and blocking it, can throw an error to abort the redirection to the page / layouts
  • layout: each page should subscribe to an existing layout
module Hello.Pages.Example (page, premount, layout) where

import Prelude

import Effect.Aff (Aff)
import Hello.Plugins.Core.Layouts as LT
import Hello.Plugins.Core.Routes as RT
import Hello.Plugins.Core.Stores (RootStore)
import Hello.Plugins.Core.UI as UI
import Hello.Plugins.Middlewares.Authenticated (authenticated)
import Reactix as R
import Reactix.DOM.HTML as H

-- this is the "Example" page component
page :: UI.Leaf()
page = UI.leaf component

-- subscribe the page to the "dashboard" layout
layout :: LT.Layout
layout = LT.Dashboad

-- Premount hook: here we have imported a middleware checking
-- the authentication of the current user (and will throw an error
-- if anonymous, catched by the Router plugin)
--
-- The premount can also served as a Store hydration, quick XHR/graph calls, etc
premount :: Record RootStore -> Aff Unit
premount rootStore = authenticated rootStore

component :: R.Component ()
component = R.hooksComponent "page-misc" cpt where
  cpt _ _ = pure mempty

  • analysis opened in milestones regarding premount variable definition

« 2.1 — Component structure             2.3 — Store structure »
Clone repository
  • 1—Application structure
  • 2—Components
    • 2.1—Component structure
    • 2.2—Page and Layout structure
    • 2.3—Store structure
  • 3—SASS-usage
    • 3.1—SASS files
    • 3.2—CSS integration model
  • 4—UI library
  • 5—Form validation
  • 6—Component Cookbook
  • 7—Miscellaneous
  • 8—Milestones
  • Home
More Pages

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.