Template for starting apps, powered by Next.js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

146 lines
2.4 KiB

  1. import * as React from 'react'
  2. import * as T from '@tesseract-design/react-common'
  3. import {GetServerSideProps, NextPage} from 'next'
  4. import Template from '../../../../components/templates/LeftSidebarWithMenuLayout'
  5. import {MORE, POPUP, QUERY, SIDEBAR} from '../../../../utilities/queryKeys'
  6. import {USER} from '../../../../utilities/popups'
  7. type Props = {
  8. query: string,
  9. sidebarMainOpen: boolean,
  10. moreItemsOpen: boolean,
  11. }
  12. const Page: NextPage<Props> = ({
  13. query,
  14. sidebarMainOpen,
  15. moreItemsOpen,
  16. }) => {
  17. return (
  18. <Template
  19. query={query}
  20. moreQueryKey={MORE}
  21. userLinkLabel="User"
  22. searchQueryKey={QUERY}
  23. searchLabel="Search"
  24. searchHint="e.g. keywords, names&hellip;"
  25. popupQueryKey={POPUP}
  26. userPopupQueryValue={USER}
  27. menuLinkLabel="Menu"
  28. sidebarQueryKey={SIDEBAR}
  29. sidebarMainOpen={sidebarMainOpen}
  30. moreLinkLabel="More"
  31. moreItemsOpen={moreItemsOpen}
  32. sidebarMenuItems={[
  33. {
  34. id: '1',
  35. label: 'P1',
  36. url: {
  37. pathname: '/hello',
  38. },
  39. icon: (
  40. <T.Icon
  41. name="square"
  42. label=""
  43. />
  44. ),
  45. },
  46. {
  47. id: '2',
  48. label: 'P2',
  49. url: {
  50. pathname: '/hello',
  51. },
  52. icon: (
  53. <T.Icon
  54. name="square"
  55. label=""
  56. />
  57. ),
  58. },
  59. {
  60. id: '3',
  61. label: 'P3',
  62. url: {
  63. pathname: '/hello',
  64. },
  65. icon: (
  66. <T.Icon
  67. name="square"
  68. label=""
  69. />
  70. ),
  71. },
  72. {
  73. id: '100',
  74. label: 'P4',
  75. url: {
  76. pathname: '/hello',
  77. },
  78. icon: (
  79. <T.Icon
  80. name="square"
  81. label=""
  82. />
  83. ),
  84. },
  85. {
  86. id: '101',
  87. label: 'P5',
  88. url: {
  89. pathname: '/hello',
  90. },
  91. icon: (
  92. <T.Icon
  93. name="square"
  94. label=""
  95. />
  96. ),
  97. },
  98. {
  99. id: '4',
  100. label: 'S1',
  101. url: {
  102. pathname: '/hello',
  103. },
  104. icon: (
  105. <T.Icon
  106. name="square"
  107. label=""
  108. />
  109. ),
  110. secondary: true,
  111. },
  112. {
  113. id: '5',
  114. label: 'S2',
  115. url: {
  116. pathname: '/hello',
  117. },
  118. icon: (
  119. <T.Icon
  120. name="square"
  121. label=""
  122. />
  123. ),
  124. secondary: true,
  125. },
  126. ]}
  127. />
  128. )
  129. }
  130. export default Page
  131. export const getServerSideProps: GetServerSideProps = async (ctx) => {
  132. const { q: query = '', } = ctx.query
  133. return {
  134. props: {
  135. query,
  136. sidebarMainOpen: 'sidebar' in ctx.query,
  137. moreItemsOpen: 'more' in ctx.query,
  138. }
  139. }
  140. }