Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting and lint errors from previous PRs #794

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,7 @@ function setAuthorName(author: string) {

prog
.command('test')
.describe(
'Run jest test runner. Passes through all flags directly to Jest'
)
.describe('Run jest test runner. Passes through all flags directly to Jest')
.action(async (opts: { config?: string }) => {
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'test';
Expand Down
40 changes: 20 additions & 20 deletions website/components/video.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
import { useRef, useCallback, useEffect } from 'react'
import { useInView } from 'react-intersection-observer'
import 'intersection-observer'
import React, { useRef, useCallback, useEffect } from 'react';
import { useInView } from 'react-intersection-observer';
import 'intersection-observer';

export default ({ src, caption, ratio }) => {
const [inViewRef, inView] = useInView({
threshold: 1,
})
const videoRef = useRef()
});
const videoRef = useRef();

const setRefs = useCallback(
(node) => {
node => {
// Ref's from useRef needs to have the node assigned to `current`
videoRef.current = node
videoRef.current = node;
// Callback refs, like the one from `useInView`, is a function that takes the node as an argument
inViewRef(node)
inViewRef(node);

if (node) {
node.addEventListener('click', function () {
node.addEventListener('click', function() {
if (this.paused) {
this.play()
this.play();
} else {
this.pause()
this.pause();
}
})
});
}
},
[inViewRef]
)
);

useEffect(() => {
if (!videoRef || !videoRef.current) {
return
return;
}

if (inView) {
videoRef.current.play()
videoRef.current.play();
} else {
videoRef.current.pause()
videoRef.current.pause();
}
}, [inView])
}, [inView]);

return (
<figure>
<div style={{ paddingBottom: ratio * 100 + '%' }}/>
<div style={{ paddingBottom: ratio * 100 + '%' }} />
<video loop muted autoPlay playsInline ref={setRefs}>
<source src={src} type="video/mp4" />
</video>
{caption && <figcaption>{caption}</figcaption>}
</figure>
)
}
);
};
5 changes: 3 additions & 2 deletions website/nextra.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { Logo } from 'components/logo';

export default {
Expand Down Expand Up @@ -67,7 +68,7 @@ export default {
<a
href="https://jaredpalmer.com/?utm_source=tsdx"
target="_blank"
rel="noopener"
rel="noopener noreferrer"
className="inline-flex items-center no-underline text-current font-semibold"
>
<span className="mr-1">A Jared Palmer Project</span>
Expand All @@ -80,7 +81,7 @@ export default {
filepath
}
target="_blank"
rel="noopener"
rel="noopener noreferrer"
>
Edit this page on GitHub
</a>
Expand Down
7 changes: 4 additions & 3 deletions website/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '.nextra/styles.css'
import GoogleFonts from 'next-google-fonts'
import React from 'react';
import '.nextra/styles.css';
import GoogleFonts from 'next-google-fonts';

export default function Nextra({ Component, pageProps }) {
return (
Expand All @@ -10,5 +11,5 @@ export default function Nextra({ Component, pageProps }) {
/>
<Component {...pageProps} />
</>
)
);
}
10 changes: 5 additions & 5 deletions website/pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import Document, { Html, Head, Main, NextScript } from 'next/document'
import { SkipNavLink } from '@reach/skip-nav'
import React from 'react';
import Document, { Html, Head, Main, NextScript } from 'next/document';
import { SkipNavLink } from '@reach/skip-nav';

class MyDocument extends Document {
render() {
Expand All @@ -18,8 +18,8 @@ class MyDocument extends Document {
/>
</body>
</Html>
)
);
}
}

export default MyDocument
export default MyDocument;
4 changes: 2 additions & 2 deletions website/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
plugins: ['tailwindcss', 'postcss-preset-env']
}
plugins: ['tailwindcss', 'postcss-preset-env'],
};
16 changes: 11 additions & 5 deletions website/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module.exports = {
purge: ['./components/**/*.js', './pages/**/*.md', './pages/**/*.mdx', './.nextra/**/*.js', './nextra.config.js'],
purge: [
'./components/**/*.js',
'./pages/**/*.md',
'./pages/**/*.mdx',
'./.nextra/**/*.js',
'./nextra.config.js',
],
theme: {
screens: {
sm: '640px',
Expand All @@ -11,7 +17,7 @@ module.exports = {
display: ['inter', 'sans-serif'],
},
letterSpacing: {
tight: '-0.015em'
}
}
}
tight: '-0.015em',
},
},
};