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.
 
 

182 lines
3.3 KiB

  1. import * as React from 'react'
  2. import styled from 'styled-components'
  3. import * as T from '@tesseract-design/react-common'
  4. import { Basic } from '@tesseract-design/viewfinder'
  5. import Link from '../../molecules/Link'
  6. import Brand from '../../molecules/Brand'
  7. const LinkContainer = styled('nav')({
  8. margin: '1rem 0',
  9. display: 'grid',
  10. gap: '1rem',
  11. '@media (min-width: 720px)': {
  12. gridTemplateColumns: 'repeat(2, 1fr)',
  13. },
  14. })
  15. const PreviewWrapper = styled('div')({
  16. overflow: 'hidden',
  17. width: '100%',
  18. paddingBottom: '150%',
  19. position: 'relative',
  20. marginTop: '0.25rem',
  21. '::after': {
  22. content: "''",
  23. position: 'absolute',
  24. top: 0,
  25. left: 0,
  26. width: '100%',
  27. height: '100%',
  28. border: '0.125rem solid',
  29. boxSizing: 'border-box',
  30. },
  31. '@media (min-width: 720px)': {
  32. paddingBottom: '75%',
  33. },
  34. })
  35. const Preview = styled('iframe')({
  36. position: 'absolute',
  37. top: 0,
  38. left: 0,
  39. border: 0,
  40. display: 'block',
  41. transformOrigin: 'top left',
  42. width: '200%',
  43. height: '200%',
  44. transform: 'scale(0.5)',
  45. '@media (min-width: 720px)': {
  46. width: '400%',
  47. height: '400%',
  48. transform: 'scale(0.25)',
  49. },
  50. })
  51. const StyledLink = styled(Link)({
  52. display: 'block',
  53. textDecoration: 'none',
  54. // borderRadius: '0.25rem',
  55. // padding: '1rem',
  56. boxSizing: 'border-box',
  57. // border: '0.125rem solid',
  58. })
  59. type Props = {
  60. query: string,
  61. userLinkLabel: string,
  62. searchQueryKey: string,
  63. searchLabel: string,
  64. searchHint: string,
  65. popupQueryKey: string,
  66. userPopupQueryValue: string,
  67. }
  68. const IndexTemplate: React.FC<Props> = ({
  69. query,
  70. userLinkLabel,
  71. searchQueryKey,
  72. searchLabel,
  73. searchHint,
  74. popupQueryKey,
  75. userPopupQueryValue,
  76. }) => {
  77. return (
  78. <Basic.Layout
  79. brand={
  80. <Brand />
  81. }
  82. topBarCenter={
  83. <form>
  84. <T.TextInput
  85. name={searchQueryKey}
  86. label={searchLabel}
  87. hint={searchHint}
  88. defaultValue={query}
  89. border
  90. alternate
  91. />
  92. </form>
  93. }
  94. userLink={
  95. <Link
  96. href={{
  97. query: {
  98. [popupQueryKey]: userPopupQueryValue,
  99. },
  100. }}
  101. >
  102. <T.Icon
  103. name="user"
  104. label={userLinkLabel}
  105. />
  106. </Link>
  107. }
  108. >
  109. <Basic.ContentContainer>
  110. <h1>
  111. Welcome
  112. </h1>
  113. <p>
  114. Select a template to preview:
  115. </p>
  116. <LinkContainer>
  117. <StyledLink
  118. href={{
  119. pathname: '/layouts/basic'
  120. }}
  121. >
  122. Basic Layout
  123. <PreviewWrapper>
  124. <Preview
  125. src="/layouts/basic"
  126. scrolling="no"
  127. />
  128. </PreviewWrapper>
  129. </StyledLink>
  130. <StyledLink
  131. href={{
  132. pathname: '/layouts/right-sidebar-static'
  133. }}
  134. >
  135. Right Sidebar (static)
  136. <PreviewWrapper>
  137. <Preview
  138. src="/layouts/right-sidebar-static"
  139. scrolling="no"
  140. />
  141. </PreviewWrapper>
  142. </StyledLink>
  143. <StyledLink
  144. href={{
  145. pathname: '/layouts/left-sidebar'
  146. }}
  147. >
  148. Left Sidebar
  149. <PreviewWrapper>
  150. <Preview
  151. src="/layouts/left-sidebar"
  152. scrolling="no"
  153. />
  154. </PreviewWrapper>
  155. </StyledLink>
  156. <StyledLink
  157. href={{
  158. pathname: '/layouts/left-sidebar/with-menu'
  159. }}
  160. >
  161. Left Sidebar (with menu)
  162. <PreviewWrapper>
  163. <Preview
  164. src="/layouts/left-sidebar/with-menu"
  165. scrolling="no"
  166. />
  167. </PreviewWrapper>
  168. </StyledLink>
  169. </LinkContainer>
  170. </Basic.ContentContainer>
  171. </Basic.Layout>
  172. )
  173. }
  174. export default IndexTemplate