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.
 
 

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