@t2ca/gatsby-theme-showcase 1.0.55 → 1.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t2ca/gatsby-theme-showcase",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "devDependencies": {
@@ -1,8 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React from "react"
3
- // import { useStaticQuery, graphql } from "gatsby"
4
- // import Img from "gatsby-image"
5
- import { jsx, Styled, Container, Flex, Box } from "theme-ui"
3
+ import { jsx, Styled, Container, Flex } from "theme-ui"
6
4
  import { motion } from "framer-motion"
7
5
 
8
6
  export default ({
@@ -11,11 +11,11 @@ import Wave from "./wave"
11
11
  const Project = (data) => {
12
12
  return (
13
13
  <React.Fragment>
14
- <Container sx={{ px: [0, 4], py: 0 }}>
14
+ <Container sx={{ px: [0, 0, 4], py: 0 }}>
15
15
  <div
16
16
  sx={{
17
17
  py: "15rem",
18
- px: ["1.5rem", "3rem"],
18
+ px: ["1.5rem", "1.5rem", "3rem"],
19
19
  zIndex: "1",
20
20
  position: "relative",
21
21
  minHeight: `75vh`, // screenHeight
@@ -29,11 +29,11 @@ export default {
29
29
  fontSize: [1],
30
30
  },
31
31
  h1: {
32
- fontSize: [4, 6, 7],
32
+ fontSize: [4, 4, 6, 7],
33
33
  fontWeight: `bold`,
34
34
  },
35
35
  h2: {
36
- fontSize: [3, 4, 5],
36
+ fontSize: [3, 3, 4, 5],
37
37
  fontWeight: `semibold`,
38
38
  },
39
39
  input: {
@@ -1,335 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx, css, ThemeProvider } from "theme-ui"
3
- import { MDXProvider } from "@mdx-js/react"
4
- import React, { useState } from "react"
5
- import { Global } from "@emotion/core"
6
- import merge from "deepmerge"
7
-
8
- const Overlay = ({ onClick }) => (
9
- <React.Fragment>
10
- <div
11
- onClick={onClick}
12
- sx={{
13
- position: "fixed",
14
- top: 0,
15
- right: 0,
16
- bottom: 0,
17
- left: 0,
18
- }}
19
- />
20
- <Global
21
- styles={css({
22
- body: {
23
- overflow: ["hidden", "auto"],
24
- },
25
- })}
26
- />
27
- </React.Fragment>
28
- )
29
-
30
- const createNestedLinks = (children, depth = 0) => {
31
- const links = React.Children.toArray(children).reduce((acc, child) => {
32
- const type = child.props && child.props.mdxType
33
- if (!child.props || !child.props.children) return acc
34
- if (type === "a") return [...acc, child]
35
- if (depth > 0 && type === "ul") {
36
- const last = acc[acc.length - 1]
37
- acc[acc.length - 1] = React.cloneElement(last, {
38
- links: createNestedLinks(child.props.children),
39
- })
40
- return acc
41
- }
42
- return [...acc, ...createNestedLinks(child.props.children, depth + 1)]
43
- }, [])
44
- return links
45
- }
46
-
47
- const flattenLinks = (children) =>
48
- React.Children.toArray(children).reduce((acc, child) => {
49
- if (child.props && child.props.mdxType === "a") {
50
- return [...acc, child]
51
- }
52
- if (!child.props || !child.props.children) return acc
53
- return React.Children.toArray([
54
- ...acc,
55
- ...flattenLinks(child.props.children),
56
- ])
57
- }, [])
58
-
59
- export const Sidenav = React.forwardRef(
60
- ({ open, styles = {}, components, ...props }, ref) => {
61
- return (
62
- <ThemeProvider
63
- theme={{
64
- styles: merge(
65
- {
66
- ul: {
67
- listStyle: "none",
68
- p: 0,
69
- m: 0,
70
- ul: {
71
- a: {
72
- pl: 4,
73
- },
74
- },
75
- },
76
- a: {
77
- display: "block",
78
- px: 2,
79
- py: 2,
80
- color: "inherit",
81
- textDecoration: "none",
82
- fontSize: 1,
83
- fontWeight: "bold",
84
- },
85
- },
86
- styles
87
- ),
88
- }}
89
- >
90
- {open && <Overlay {...props} />}
91
- <MDXProvider components={components}>
92
- <div
93
- {...props}
94
- ref={ref}
95
- sx={{
96
- position: ["fixed", "sticky"],
97
- top: 0,
98
- left: 0,
99
- bottom: [0, "auto"],
100
- zIndex: 1,
101
- minWidth: 0,
102
- width: 256,
103
- maxHeight: ["100vh", "none"],
104
- overflowX: "visible",
105
- overflowY: "auto",
106
- WebkitOverflowScrolling: "touch",
107
- transition: "transform .2s ease-out",
108
- transform: [open ? "translateX(0)" : "translate(-100%)", "none"],
109
- bg: ["background", "transparent"],
110
- }}
111
- />
112
- </MDXProvider>
113
- </ThemeProvider>
114
- )
115
- }
116
- )
117
-
118
- export const AccordionButton = (props) => {
119
- const transform = props.open ? "rotate(-180 8 8)" : "rotate(0 8 8)"
120
- const disabled = props.pathname && props.pathname.includes(props.href)
121
-
122
- return (
123
- <button
124
- title="Expand Section"
125
- disabled={disabled}
126
- {...props}
127
- sx={{
128
- appearance: "none",
129
- display: "flex",
130
- alignItems: "center",
131
- p: 2,
132
- m: 0,
133
- border: 0,
134
- borderRadius: 0,
135
- color: "inherit",
136
- bg: "transparent",
137
- ":hover,:focus": {
138
- color: "primary",
139
- },
140
- "&:disabled": {
141
- opacity: 0.25,
142
- },
143
- }}
144
- >
145
- <svg viewBox="0 0 16 16" width="12" height="12">
146
- <g
147
- sx={{
148
- transformOrigin: "8 8",
149
- transition: "transform .1s ease-out",
150
- }}
151
- transform={transform}
152
- >
153
- <path
154
- stroke="currentcolor"
155
- strokeWidth="2"
156
- fill="none"
157
- d="M14 6 L8 12 L2 6"
158
- />
159
- </g>
160
- </svg>
161
- </button>
162
- )
163
- }
164
-
165
- const NavLinks = ({ open, pathname = "", links, href, Link, ...props }) => {
166
- if (!links) return false
167
- if (!open && !pathname.includes(href)) return false
168
-
169
- return (
170
- <ul
171
- sx={{
172
- listStyle: "none",
173
- m: 0,
174
- p: 0,
175
- }}
176
- >
177
- {links.map((link, j) => (
178
- <li key={j}>
179
- <Link
180
- href={link.props.href}
181
- children={link.props.children}
182
- className={link.props.className}
183
- sx={{
184
- pl: 4,
185
- }}
186
- />
187
- </li>
188
- ))}
189
- </ul>
190
- )
191
- }
192
-
193
- export const AccordionNav = React.forwardRef(
194
- (
195
- { open, children, components = {}, className, pathname = "", ...props },
196
- ref
197
- ) => {
198
- const links = createNestedLinks(children)
199
- const [expanded, setExpanded] = useState({})
200
- const Link = components.a || "a"
201
-
202
- const toggle = (i) => (e) => {
203
- e.stopPropagation()
204
- setExpanded({
205
- ...expanded,
206
- [i]: !expanded[i],
207
- })
208
- }
209
-
210
- return (
211
- <div>
212
- {open && <Overlay {...props} />}
213
- <div
214
- ref={ref}
215
- className={className}
216
- sx={{
217
- position: ["fixed", "sticky"],
218
- top: 0,
219
- left: 0,
220
- bottom: [0, "auto"],
221
- zIndex: 1,
222
- minWidth: 0,
223
- width: 256,
224
- maxHeight: ["100vh", "none"],
225
- overflowX: "visible",
226
- overflowY: "auto",
227
- WebkitOverflowScrolling: "touch",
228
- transition: "transform .2s ease-out",
229
- transform: [open ? "translateX(0)" : "translate(-100%)", "none"],
230
- bg: ["background", "transparent"],
231
- }}
232
- >
233
- <ul
234
- sx={{
235
- listStyle: "none",
236
- p: 0,
237
- m: 0,
238
- }}
239
- >
240
- {links.map((link, i) => (
241
- <li key={i}>
242
- <div
243
- sx={{
244
- display: "flex",
245
- alignItems: "center",
246
- }}
247
- >
248
- <Link
249
- href={link.props.href}
250
- children={link.props.children}
251
- className={link.props.className}
252
- />
253
- {link.props.links && (
254
- <AccordionButton
255
- href={link.props.href}
256
- pathname={pathname}
257
- open={expanded[i]}
258
- sx={{
259
- ml: "auto",
260
- }}
261
- onClick={toggle(i)}
262
- />
263
- )}
264
- </div>
265
- <NavLinks
266
- {...link.props}
267
- open={expanded[i]}
268
- pathname={pathname}
269
- Link={Link}
270
- />
271
- </li>
272
- ))}
273
- </ul>
274
- </div>
275
- </div>
276
- )
277
- }
278
- )
279
-
280
- const removeSlash = (str) => (str.length > 1 ? str.replace(/\/$/, "") : str)
281
-
282
- const PaginationLink = ({
283
- label,
284
- children,
285
- mdxType,
286
- originalType,
287
- parentName,
288
- ...props
289
- }) => (
290
- <a
291
- {...props}
292
- sx={{
293
- fontSize: 1,
294
- color: "inherit",
295
- textDecoration: "none",
296
- fontWeight: "bold",
297
- }}
298
- >
299
- <div>{label}</div>
300
- <div
301
- sx={{
302
- fontSize: 3,
303
- }}
304
- >
305
- {children}
306
- </div>
307
- </a>
308
- )
309
-
310
- export const Pagination = ({ pathname = "", children, ...props }) => {
311
- const links = flattenLinks(children)
312
- const index = links.findIndex(
313
- (link) => link.props.href === removeSlash(pathname)
314
- )
315
- const hasPagination = index > -1
316
- const previous = links[index - 1]
317
- const next = links[index + 1]
318
-
319
- return (
320
- <div
321
- {...props}
322
- sx={{
323
- display: "flex",
324
- }}
325
- >
326
- {hasPagination && previous && (
327
- <PaginationLink {...previous.props} label="Previous:" />
328
- )}
329
- <div sx={{ mx: "auto" }} />
330
- {hasPagination && next && (
331
- <PaginationLink {...next.props} label="Next:" />
332
- )}
333
- </div>
334
- )
335
- }