README.md34 lines · main
1# Writing pages
2
3## Rough guidelines
4
5- Try to break down your pages into smaller building blocks - components which are tightly coupled to a page can be placed within the folder `components/interfaces/xxx/...` (Refer to the README.md under the components folder)
6- Keep to using `useState` hooks for any UI related logic, do not create MobX local stores to handle UI logic.
7
8## Template for building pages
9
10```tsx
11import { NextPage } from 'next'
12import { withAuth } from 'hooks/misc/withAuth'
13
14// Import the corresponding layout based on the page
15import { Layout } from 'components/layouts'
16
17// Import the main building blocks of the page
18import { ... } from 'components/interfaces/xxx'
19
20// Import reusable UI components if needed
21import { ... } from 'components/ui/xxx'
22
23// Name your page accordingly
24const Page: NextPage = () => {
25
26 return (
27 <Layout>
28 <div>Page content</div>
29 </Layout>
30 )
31}
32
33export default withAuth(Page)
34```
Preview

Writing pages

Rough guidelines

  • Try to break down your pages into smaller building blocks - components which are tightly coupled to a page can be placed within the folder components/interfaces/xxx/... (Refer to the README.md under the components folder)
  • Keep to using useState hooks for any UI related logic, do not create MobX local stores to handle UI logic.

Template for building pages

import { NextPage } from 'next'
import { withAuth } from 'hooks/misc/withAuth'

// Import the corresponding layout based on the page
import { Layout } from 'components/layouts'

// Import the main building blocks of the page
import { ... } from 'components/interfaces/xxx'

// Import reusable UI components if needed
import { ... } from 'components/ui/xxx'

// Name your page accordingly
const Page: NextPage = () => {

  return (
    <Layout>
      <div>Page content</div>
    </Layout>
  )
}

export default withAuth(Page)