@enhanced-dom/slides 0.0.3 → 0.0.6
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/components/index.d.ts +1 -2
- package/components/index.js +1 -2
- package/{shell → components/shell}/header.component.d.ts +1 -3
- package/components/shell/header.component.js +19 -0
- package/{shell → components/shell}/index.d.ts +0 -0
- package/{shell → components/shell}/index.js +0 -0
- package/{shell → components/shell}/scroll-top/icon.component.d.ts +0 -7
- package/{shell → components/shell}/scroll-top/icon.component.js +1 -1
- package/{shell → components/shell}/scroll-top/index.d.ts +0 -0
- package/{shell → components/shell}/scroll-top/index.js +0 -0
- package/{shell → components/shell}/scroll-top/scroll-top.component.d.ts +0 -0
- package/components/shell/scroll-top/scroll-top.component.js +37 -0
- package/components/shell/scroll-top/scroll-top.style.pcss +25 -0
- package/{shell/scroll-top/scroll-top.style.scss.d.ts → components/shell/scroll-top/scroll-top.style.pcss.d.ts} +0 -0
- package/{shell → components/shell}/shell.component.d.ts +0 -1
- package/components/shell/shell.component.js +44 -0
- package/components/toc.component.d.ts +2 -3
- package/components/toc.component.js +4 -10
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +34 -47
- package/theme.js +2 -2
- package/components/component-wave.component.d.ts +0 -8
- package/components/component-wave.component.js +0 -28
- package/components/image-wave.component.d.ts +0 -5
- package/components/image-wave.component.js +0 -27
- package/components/wave.component.d.ts +0 -10
- package/components/wave.component.js +0 -37
- package/shell/header.component.js +0 -24
- package/shell/scroll-top/scroll-top.component.js +0 -31
- package/shell/scroll-top/scroll-top.style.scss +0 -26
- package/shell/shell.component.js +0 -51
package/components/index.d.ts
CHANGED
package/components/index.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
+
import { Themed } from 'theme-ui';
|
|
3
|
+
import { SizeVariableNames, ColorVariableNames } from '../../theme';
|
|
4
|
+
export const ShellHeader = ({ title, author, date }) => {
|
|
5
|
+
return (_jsxs("div", Object.assign({ sx: { position: 'relative' } }, { children: [_jsx("div", Object.assign({ sx: {
|
|
6
|
+
position: ['static', 'absolute'],
|
|
7
|
+
width: '100%',
|
|
8
|
+
height: ['auto', '100%'],
|
|
9
|
+
right: ['auto', SizeVariableNames.FULL_CONTENT_WIDTH],
|
|
10
|
+
color: ['text', ColorVariableNames.LIGHT_TEXT],
|
|
11
|
+
} }, { children: _jsx("div", Object.assign({ sx: {
|
|
12
|
+
float: ['none', 'right'],
|
|
13
|
+
display: ['block', 'inline-block'],
|
|
14
|
+
textAlign: ['left', 'right'],
|
|
15
|
+
} }, { children: _jsx(Themed.h1, Object.assign({ sx: { paddingBottom: '80px' } }, { children: title }), void 0) }), void 0) }), void 0),
|
|
16
|
+
_jsx("div", { children: _jsxs(Themed.p, Object.assign({ sx: { paddingTop: 1 } }, { children: [_jsx(Themed.a, Object.assign({ href: "/", sx: { textDecoration: 'none', color: 'inherit', border: 'none' } }, { children: author }), void 0),
|
|
17
|
+
_jsx("br", {}, void 0),
|
|
18
|
+
_jsx("span", Object.assign({ sx: { fontSize: 1 } }, { children: date }), void 0)] }), void 0) }, void 0)] }), void 0));
|
|
19
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -7,13 +7,6 @@ declare interface IconAttributes extends Omit<React.DetailedHTMLProps<React.HTML
|
|
|
7
7
|
style?: React.CSSProperties;
|
|
8
8
|
config: IconConfigType;
|
|
9
9
|
}
|
|
10
|
-
declare global {
|
|
11
|
-
namespace JSX {
|
|
12
|
-
interface IntrinsicElements {
|
|
13
|
-
['enhanced-dom-icon']: IconAttributes;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
10
|
export declare const Icon: import("react").ComponentType<IconAttributes> & {
|
|
18
11
|
renderer: import("@enhanced-dom/icon").MultiIconRenderer;
|
|
19
12
|
} & Record<string, AnalyserNode>;
|
|
@@ -2,7 +2,7 @@ import { withReactAdapter } from '@enhanced-dom/react';
|
|
|
2
2
|
import { IconWebComponent } from '@enhanced-dom/icon';
|
|
3
3
|
import { FontawesomeIconRenderer } from '@enhanced-dom/fontawesome';
|
|
4
4
|
IconWebComponent.addIconInterpreter('fa5', new FontawesomeIconRenderer());
|
|
5
|
+
IconWebComponent.register();
|
|
5
6
|
export const Icon = withReactAdapter({
|
|
6
7
|
type: IconWebComponent,
|
|
7
|
-
name: 'enhanced-dom-icon',
|
|
8
8
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ReactCardFlip from 'react-card-flip';
|
|
4
|
+
import { faArrowAltCircleUp } from '@fortawesome/free-regular-svg-icons';
|
|
5
|
+
import * as styles from './scroll-top.style.pcss';
|
|
6
|
+
import { Icon } from './icon.component';
|
|
7
|
+
const getBodyScroll = () => {
|
|
8
|
+
return document.body.scrollTop !== 0 || document.documentElement.scrollTop !== 0;
|
|
9
|
+
};
|
|
10
|
+
const scrollToTop = () => {
|
|
11
|
+
if (getBodyScroll()) {
|
|
12
|
+
window.scrollBy(0, -50);
|
|
13
|
+
requestAnimationFrame(scrollToTop);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const scrollOnKey = (e) => {
|
|
17
|
+
if (e.altKey || e.shiftKey || e.ctrlKey || e.key !== 'Enter') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
scrollToTop();
|
|
23
|
+
};
|
|
24
|
+
export const ScrollTop = ({ children }) => {
|
|
25
|
+
const [isFlipped, setFlipped] = React.useState(false);
|
|
26
|
+
const showButton = React.useCallback(() => {
|
|
27
|
+
if (getBodyScroll()) {
|
|
28
|
+
setFlipped(true);
|
|
29
|
+
}
|
|
30
|
+
}, [setFlipped]);
|
|
31
|
+
const showFront = React.useCallback(() => {
|
|
32
|
+
setFlipped(false);
|
|
33
|
+
}, [setFlipped]);
|
|
34
|
+
const buttonContents = children ? (_jsxs(ReactCardFlip, Object.assign({ isFlipped: isFlipped, flipDirection: "horizontal" }, { children: [_jsx("div", { children: children }, void 0),
|
|
35
|
+
_jsx("div", Object.assign({ className: styles.brandingBack }, { children: _jsx(Icon, { config: { ...faArrowAltCircleUp, namespace: 'fa5' } }, void 0) }), void 0)] }), void 0)) : (_jsx("div", Object.assign({ className: styles.brandingBack }, { children: _jsx(Icon, { config: { ...faArrowAltCircleUp, namespace: 'fa5' } }, void 0) }), void 0));
|
|
36
|
+
return (_jsx("div", Object.assign({ className: styles.branding, tabIndex: 0, role: "button", onClick: scrollToTop, onFocus: showButton, onBlur: showFront, onMouseEnter: showButton, onMouseLeave: showFront, onKeyPress: scrollOnKey }, { children: buttonContents }), void 0));
|
|
37
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.branding {
|
|
2
|
+
width: 3rem;
|
|
3
|
+
height: 3rem;
|
|
4
|
+
position: fixed;
|
|
5
|
+
bottom: 2.5rem;
|
|
6
|
+
right: 2.5rem;
|
|
7
|
+
z-index: 1;
|
|
8
|
+
outline-color: #e2001a;
|
|
9
|
+
color: #e2001a;
|
|
10
|
+
|
|
11
|
+
> div {
|
|
12
|
+
height: 100%;
|
|
13
|
+
width: 100%;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: space-around;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-back {
|
|
20
|
+
background-color: transparent;
|
|
21
|
+
font-size: 2rem;
|
|
22
|
+
color: #e2001a;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
+
/** @jsxFrag React.Fragment */
|
|
3
|
+
import { Themed, ThemeProvider } from 'theme-ui';
|
|
4
|
+
import { Global } from '@emotion/react';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import defaultTheme, { ColorVariableNames, SizeVariableNames } from '../../theme';
|
|
7
|
+
import { ShellHeader } from './header.component';
|
|
8
|
+
import { ScrollTop } from './scroll-top';
|
|
9
|
+
const BrandingSlot = ({ children }) => {
|
|
10
|
+
return children || null;
|
|
11
|
+
};
|
|
12
|
+
const ContentsSlot = ({ children, ...rest }) => {
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsx(ShellHeader, Object.assign({}, rest), void 0), children || null] }, void 0));
|
|
14
|
+
};
|
|
15
|
+
const getBranding = (children) => React.Children.toArray(children).find((item) => { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.type) === BrandingSlot; });
|
|
16
|
+
const getContents = (children) => React.Children.toArray(children).find((item) => { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.type) === ContentsSlot; });
|
|
17
|
+
export const Shell = ({ children, theme, }) => {
|
|
18
|
+
const branding = getBranding(children);
|
|
19
|
+
const contents = getContents(children);
|
|
20
|
+
return (_jsx(ThemeProvider, Object.assign({ theme: theme }, { children: _jsxs(Themed.root, Object.assign({ sx: {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
width: '100vw',
|
|
23
|
+
} }, { children: [_jsx(Global, { styles: {
|
|
24
|
+
body: { margin: 0, overflowX: 'hidden' },
|
|
25
|
+
} }, void 0),
|
|
26
|
+
_jsx("aside", { sx: {
|
|
27
|
+
bg: ColorVariableNames.DARK_BACKGROUND,
|
|
28
|
+
color: ColorVariableNames.LIGHT_TEXT,
|
|
29
|
+
width: [0, '40vw'],
|
|
30
|
+
minHeight: '100vh',
|
|
31
|
+
} }, void 0),
|
|
32
|
+
_jsx("div", Object.assign({ sx: { bg: ColorVariableNames.BACKGROUND, color: ColorVariableNames.TEXT, width: ['100vw', '60vw'] } }, { children: _jsxs("main", Object.assign({ sx: {
|
|
33
|
+
py: [5, SizeVariableNames.TOP_MARGIN],
|
|
34
|
+
pl: [0, SizeVariableNames.INNER_MARGIN],
|
|
35
|
+
width: [SizeVariableNames.CONTENT, SizeVariableNames.CONTENT],
|
|
36
|
+
maxWidth: ['80%', 'none'],
|
|
37
|
+
mx: ['auto', 0],
|
|
38
|
+
} }, { children: [contents, branding ? _jsx(ScrollTop, { children: branding }, void 0) : null] }), void 0) }), void 0)] }), void 0) }), void 0));
|
|
39
|
+
};
|
|
40
|
+
Shell.defaultProps = {
|
|
41
|
+
theme: defaultTheme,
|
|
42
|
+
};
|
|
43
|
+
Shell.Branding = BrandingSlot;
|
|
44
|
+
Shell.Contents = ContentsSlot;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
interface TocItemProps {
|
|
3
2
|
heading: string;
|
|
4
3
|
to?: string;
|
|
@@ -7,9 +6,9 @@ interface TocItemProps {
|
|
|
7
6
|
export declare const Toc: {
|
|
8
7
|
({ headings }: {
|
|
9
8
|
headings: TocItemProps[];
|
|
10
|
-
}): JSX.Element;
|
|
9
|
+
}): import("theme-ui/jsx-runtime").JSX.Element;
|
|
11
10
|
Heading: ({ heading }: {
|
|
12
11
|
heading: string;
|
|
13
|
-
}) => JSX.Element;
|
|
12
|
+
}) => import("theme-ui/jsx-runtime").JSX.Element;
|
|
14
13
|
};
|
|
15
14
|
export {};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
const Heading = ({ heading }) => (
|
|
3
|
-
heading,
|
|
4
|
-
React.createElement("a", { style: { display: 'none' }, id: heading.toLowerCase().replace(/\s/, '-') })));
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
+
const Heading = ({ heading }) => (_jsxs("h2", { children: [heading, _jsx("a", Object.assign({ href: `#${heading.toLowerCase().replace(/\s/, '-')}`, style: { display: 'none' }, id: heading.toLowerCase().replace(/\s/, '-') }, { children: '' }), void 0)] }, void 0));
|
|
5
3
|
const TocItem = ({ heading, to, explanation }) => {
|
|
6
4
|
const anchor = to !== null && to !== void 0 ? to : heading;
|
|
7
|
-
return (
|
|
8
|
-
React.createElement("a", { href: `#${anchor.toLowerCase().replace(/\s/, '-')}` },
|
|
9
|
-
React.createElement("em", null, heading)),
|
|
10
|
-
explanation ? ': ' : '',
|
|
11
|
-
explanation));
|
|
5
|
+
return (_jsxs("li", { children: [_jsx("a", Object.assign({ href: `#${anchor.toLowerCase().replace(/\s/, '-')}` }, { children: _jsx("em", { children: heading }, void 0) }), void 0), explanation ? ': ' : '', explanation] }, void 0));
|
|
12
6
|
};
|
|
13
|
-
export const Toc = ({ headings }) => (
|
|
7
|
+
export const Toc = ({ headings }) => (_jsx("ul", { children: headings.map((h, idx) => (_jsx(TocItem, Object.assign({}, h), idx))) }, void 0));
|
|
14
8
|
Toc.Heading = Heading;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,47 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@enhanced-dom/slides",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Basic building blocks for html slides",
|
|
5
|
-
"keywords": [],
|
|
6
|
-
"repository": "https://github.com/enhanced-dom/slides.git",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
|
|
9
|
-
"main": "index.js",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
"@enhanced-dom/lint": "^0.0.3",
|
|
36
|
-
"@types/lodash.pick": "^4.4.6",
|
|
37
|
-
"@types/react": "^17.0.8",
|
|
38
|
-
"@types/react-dom": "^17.0.5",
|
|
39
|
-
"copyfiles": "2.4.1",
|
|
40
|
-
"rimraf": "3.0.2",
|
|
41
|
-
"typescript": "4.2.2"
|
|
42
|
-
},
|
|
43
|
-
"engines": {
|
|
44
|
-
"node": ">=14.17.0",
|
|
45
|
-
"npm": ">=8.0.0"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@enhanced-dom/slides",
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"description": "Basic building blocks for html slides",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"repository": "https://github.com/enhanced-dom/slides.git",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
|
|
9
|
+
"main": "index.js",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@emotion/react": "^11.9.0",
|
|
12
|
+
"@enhanced-dom/fontawesome": "^0.0.3",
|
|
13
|
+
"@enhanced-dom/gatsby-waves": "^0.0.1",
|
|
14
|
+
"@enhanced-dom/icon": "^0.0.4",
|
|
15
|
+
"@enhanced-dom/react": "^0.0.6",
|
|
16
|
+
"@fontsource/montserrat": "^4.5.10",
|
|
17
|
+
"@theme-ui/typography": "^0.14.5",
|
|
18
|
+
"deepmerge": "^4.2.2",
|
|
19
|
+
"lodash.pick": "^4.4.0",
|
|
20
|
+
"react-card-flip": "^1.1.1",
|
|
21
|
+
"typography-theme-wordpress-2016": "^0.16.19"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@enhanced-dom/lint": "^0.0.7",
|
|
25
|
+
"@enhanced-dom/webpack": "^0.0.7",
|
|
26
|
+
"@types/lodash.pick": "^4.4.6",
|
|
27
|
+
"@types/react": "^17.0.8",
|
|
28
|
+
"@types/react-dom": "^17.0.5"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=14.17.0",
|
|
32
|
+
"npm": ">=8.0.0"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/theme.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
import { toTheme } from '@theme-ui/typography';
|
|
2
3
|
import typography from 'typography-theme-wordpress-2016';
|
|
3
4
|
import merge from 'deepmerge';
|
|
4
5
|
import '@fontsource/montserrat';
|
|
5
6
|
import pick from 'lodash.pick';
|
|
6
|
-
|
|
7
|
-
import blogTheme from 'gatsby-theme-blog/src/gatsby-plugin-theme-ui/components';
|
|
7
|
+
import { blogTheme } from '@enhanced-dom/gatsby-waves';
|
|
8
8
|
const typographyTheme = toTheme(typography);
|
|
9
9
|
export var ColorVariableNames;
|
|
10
10
|
(function (ColorVariableNames) {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Wave } from './wave.component';
|
|
3
|
-
export declare class ComponentWave extends Wave {
|
|
4
|
-
static Slot: ({ children }: {
|
|
5
|
-
children: any;
|
|
6
|
-
}) => any;
|
|
7
|
-
protected toColumns: (items: React.ReactElement[]) => [React.ReactElement<any, string | React.JSXElementConstructor<any>>[], React.ReactElement<any, string | React.JSXElementConstructor<any>>[]];
|
|
8
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Wave } from './wave.component';
|
|
3
|
-
const ComponentWaveSlot = ({ children }) => {
|
|
4
|
-
return children || null;
|
|
5
|
-
};
|
|
6
|
-
export class ComponentWave extends Wave {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.toColumns = (items) => {
|
|
10
|
-
const columns = Array(2)
|
|
11
|
-
.fill(null)
|
|
12
|
-
.map(() => []);
|
|
13
|
-
items.forEach((item) => {
|
|
14
|
-
const isComponentSlot = item.type && typeof item.type === typeof ComponentWaveSlot;
|
|
15
|
-
if (isComponentSlot) {
|
|
16
|
-
columns[0].push(item);
|
|
17
|
-
columns[1].push(React.createElement('div', {}, []));
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
const step = columns[0].length - 1;
|
|
21
|
-
columns[1][step].props.children.push(item);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return columns;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
ComponentWave.Slot = ComponentWaveSlot;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Wave } from './wave.component';
|
|
3
|
-
export declare class ImageWave extends Wave {
|
|
4
|
-
protected toColumns: (items: React.ReactElement[]) => [React.ReactElement<any, string | React.JSXElementConstructor<any>>[], React.ReactElement<any, string | React.JSXElementConstructor<any>>[]];
|
|
5
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Wave } from './wave.component';
|
|
3
|
-
export class ImageWave extends Wave {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.toColumns = (items) => {
|
|
7
|
-
const columns = Array(2)
|
|
8
|
-
.fill(null)
|
|
9
|
-
.map(() => []);
|
|
10
|
-
items.forEach((item) => {
|
|
11
|
-
const isImg = item.props && item.props.mdxType === 'img';
|
|
12
|
-
if (isImg) {
|
|
13
|
-
const img = React.cloneElement(item, {
|
|
14
|
-
style: { objectFit: 'contain', margin: 0 },
|
|
15
|
-
});
|
|
16
|
-
columns[0].push(img);
|
|
17
|
-
columns[1].push(React.createElement('div', {}, []));
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
const step = columns[0].length - 1;
|
|
21
|
-
columns[1][step].props.children.push(item);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return columns;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from 'theme-ui';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
export declare abstract class Wave extends React.PureComponent<{
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
}> {
|
|
7
|
-
protected abstract toColumns: (children: React.ReactElement[]) => [React.ReactElement[], React.ReactElement[]];
|
|
8
|
-
private childrenToColumns;
|
|
9
|
-
render(): jsx.JSX.Element;
|
|
10
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from 'theme-ui';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import Scroller from 'gatsby-theme-waves/src/components/bar-scroller';
|
|
5
|
-
import BaseWave from 'gatsby-theme-waves/src/components/wave';
|
|
6
|
-
const Sticker = ({ progress = 0, steps, variant = 'default' }) => {
|
|
7
|
-
const currentStep = Math.round(progress);
|
|
8
|
-
const prev = steps[currentStep - 1];
|
|
9
|
-
const curr = steps[currentStep];
|
|
10
|
-
const next = steps[currentStep + 1];
|
|
11
|
-
return (jsx("div", { sx: {
|
|
12
|
-
variant: `styles.waves.${variant}.StickerContainer`,
|
|
13
|
-
} },
|
|
14
|
-
jsx("div", { sx: { variant: `styles.waves.${variant}.Sticker` } },
|
|
15
|
-
prev && (jsx("div", { sx: {
|
|
16
|
-
variant: `styles.waves.${variant}.StickerStep`,
|
|
17
|
-
}, style: { opacity: Math.max(0, currentStep - progress) }, key: currentStep - 1 }, prev)),
|
|
18
|
-
jsx("div", { sx: {
|
|
19
|
-
variant: `styles.waves.${variant}.StickerStep`,
|
|
20
|
-
}, style: { opacity: 1 - Math.abs(currentStep - progress) }, key: currentStep }, curr),
|
|
21
|
-
next && (jsx("div", { sx: {
|
|
22
|
-
variant: `styles.waves.${variant}.StickerStep`,
|
|
23
|
-
}, style: { opacity: Math.max(0, progress - currentStep) }, key: currentStep + 1 }, next)))));
|
|
24
|
-
};
|
|
25
|
-
export class Wave extends React.PureComponent {
|
|
26
|
-
constructor() {
|
|
27
|
-
super(...arguments);
|
|
28
|
-
this.childrenToColumns = (children) => {
|
|
29
|
-
const items = React.Children.toArray(children);
|
|
30
|
-
const columns = this.toColumns(items);
|
|
31
|
-
return columns;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
return jsx(BaseWave, Object.assign({ columnComponents: [Sticker, Scroller], childrenToStepColumns: this.childrenToColumns }, this.props));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { Themed, jsx } from 'theme-ui';
|
|
3
|
-
import { SizeVariableNames, ColorVariableNames } from '../theme';
|
|
4
|
-
export const ShellHeader = ({ title, author, date }) => {
|
|
5
|
-
return (jsx("div", { sx: { position: 'relative' } },
|
|
6
|
-
jsx("div", { sx: {
|
|
7
|
-
position: ['static', 'absolute'],
|
|
8
|
-
width: '100%',
|
|
9
|
-
height: ['auto', '100%'],
|
|
10
|
-
right: ['auto', SizeVariableNames.FULL_CONTENT_WIDTH],
|
|
11
|
-
color: ['text', ColorVariableNames.LIGHT_TEXT],
|
|
12
|
-
} },
|
|
13
|
-
jsx("div", { sx: {
|
|
14
|
-
float: ['none', 'right'],
|
|
15
|
-
display: ['block', 'inline-block'],
|
|
16
|
-
textAlign: ['left', 'right'],
|
|
17
|
-
} },
|
|
18
|
-
jsx(Themed.h1, { sx: { paddingBottom: '80px' } }, title))),
|
|
19
|
-
jsx("div", null,
|
|
20
|
-
jsx(Themed.p, { sx: { paddingTop: 1 } },
|
|
21
|
-
jsx(Themed.a, { href: "/", sx: { textDecoration: 'none', color: 'inherit', border: 'none' } }, author),
|
|
22
|
-
jsx("br", null),
|
|
23
|
-
jsx("span", { sx: { fontSize: 1 } }, date)))));
|
|
24
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactCardFlip from 'react-card-flip';
|
|
3
|
-
import { faArrowAltCircleUp } from '@fortawesome/free-regular-svg-icons';
|
|
4
|
-
import * as styles from './scroll-top.style.scss';
|
|
5
|
-
import { Icon } from './icon.component';
|
|
6
|
-
const getBodyScroll = () => {
|
|
7
|
-
return document.body.scrollTop !== 0 || document.documentElement.scrollTop !== 0;
|
|
8
|
-
};
|
|
9
|
-
const scrollToTop = () => {
|
|
10
|
-
if (getBodyScroll()) {
|
|
11
|
-
window.scrollBy(0, -50);
|
|
12
|
-
requestAnimationFrame(scrollToTop);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export const ScrollTop = ({ children }) => {
|
|
16
|
-
const [isFlipped, setFlipped] = React.useState(false);
|
|
17
|
-
const showButton = () => {
|
|
18
|
-
if (getBodyScroll()) {
|
|
19
|
-
setFlipped(true);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const showFront = () => {
|
|
23
|
-
setFlipped(false);
|
|
24
|
-
};
|
|
25
|
-
const buttonContents = children ? (React.createElement(ReactCardFlip, { isFlipped: isFlipped, flipDirection: "horizontal" },
|
|
26
|
-
React.createElement("div", null, children),
|
|
27
|
-
React.createElement("div", { className: styles.brandingBack },
|
|
28
|
-
React.createElement(Icon, { config: { ...faArrowAltCircleUp, namespace: 'fa5' } })))) : (React.createElement("div", { className: styles.brandingBack },
|
|
29
|
-
React.createElement(Icon, { config: { ...faArrowAltCircleUp, namespace: 'fa5' } })));
|
|
30
|
-
return (React.createElement("div", { className: styles.branding, tabIndex: 0, role: "button", onClick: scrollToTop, onFocus: showButton, onBlur: showFront, onMouseEnter: showButton, onMouseLeave: showFront }, buttonContents));
|
|
31
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
.branding {
|
|
2
|
-
width: 3rem;
|
|
3
|
-
height: 3rem;
|
|
4
|
-
position: fixed;
|
|
5
|
-
bottom: 2.5rem;
|
|
6
|
-
right: 2.5rem;
|
|
7
|
-
z-index: 1;
|
|
8
|
-
outline-color: #e2001a;
|
|
9
|
-
color: #e2001a;
|
|
10
|
-
|
|
11
|
-
> div {
|
|
12
|
-
height: 100%;
|
|
13
|
-
width: 100%;
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
justify-content: space-around;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&-back {
|
|
20
|
-
background-color: transparent;
|
|
21
|
-
font-size: 2rem;
|
|
22
|
-
color: #e2001a;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}
|
package/shell/shell.component.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
/** @jsxFrag React.Fragment */
|
|
3
|
-
import { jsx, Themed, ThemeProvider } from 'theme-ui';
|
|
4
|
-
import { Global } from '@emotion/react';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import defaultTheme, { ColorVariableNames, SizeVariableNames } from '../theme';
|
|
7
|
-
import { ShellHeader } from './header.component';
|
|
8
|
-
import { ScrollTop } from './scroll-top';
|
|
9
|
-
const BrandingSlot = ({ children }) => {
|
|
10
|
-
return children || null;
|
|
11
|
-
};
|
|
12
|
-
const ContentsSlot = ({ children, ...rest }) => {
|
|
13
|
-
return (jsx(React.Fragment, null,
|
|
14
|
-
jsx(ShellHeader, Object.assign({}, rest)),
|
|
15
|
-
children || null));
|
|
16
|
-
};
|
|
17
|
-
const getBranding = (children) => React.Children.toArray(children).find((item) => { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.type) === BrandingSlot; });
|
|
18
|
-
const getContents = (children) => React.Children.toArray(children).find((item) => { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.type) === ContentsSlot; });
|
|
19
|
-
export const Shell = ({ children, theme, }) => {
|
|
20
|
-
const branding = getBranding(children);
|
|
21
|
-
const contents = getContents(children);
|
|
22
|
-
return (jsx(ThemeProvider, { theme: theme },
|
|
23
|
-
jsx(Themed.root, { sx: {
|
|
24
|
-
display: 'flex',
|
|
25
|
-
width: '100vw',
|
|
26
|
-
} },
|
|
27
|
-
jsx(Global, { styles: {
|
|
28
|
-
body: { margin: 0, overflowX: 'hidden' },
|
|
29
|
-
} }),
|
|
30
|
-
jsx("aside", { sx: {
|
|
31
|
-
bg: ColorVariableNames.DARK_BACKGROUND,
|
|
32
|
-
color: ColorVariableNames.LIGHT_TEXT,
|
|
33
|
-
width: [0, '40vw'],
|
|
34
|
-
minHeight: '100vh',
|
|
35
|
-
} }),
|
|
36
|
-
jsx("div", { sx: { bg: ColorVariableNames.BACKGROUND, color: ColorVariableNames.TEXT, width: ['100vw', '60vw'] } },
|
|
37
|
-
jsx("main", { sx: {
|
|
38
|
-
py: [5, SizeVariableNames.TOP_MARGIN],
|
|
39
|
-
pl: [0, SizeVariableNames.INNER_MARGIN],
|
|
40
|
-
width: [SizeVariableNames.CONTENT, SizeVariableNames.CONTENT],
|
|
41
|
-
maxWidth: ['80%', 'none'],
|
|
42
|
-
mx: ['auto', 0],
|
|
43
|
-
} },
|
|
44
|
-
contents,
|
|
45
|
-
branding ? jsx(ScrollTop, null, branding) : null)))));
|
|
46
|
-
};
|
|
47
|
-
Shell.defaultProps = {
|
|
48
|
-
theme: defaultTheme,
|
|
49
|
-
};
|
|
50
|
-
Shell.Branding = BrandingSlot;
|
|
51
|
-
Shell.Contents = ContentsSlot;
|