Skip to content

Commit

Permalink
Merge pull request timlrx#88 from timlrx/next11
Browse files Browse the repository at this point in the history
Upgrade nextjs and tailwind dependencies
  • Loading branch information
timlrx authored Jun 23, 2021
2 parents 4d23bae + 497442c commit f3433c8
Show file tree
Hide file tree
Showing 11 changed files with 2,030 additions and 11,809 deletions.
16 changes: 2 additions & 14 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
},
env: {
browser: true,
amd: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
'next',
'next/core-web-vitals',
],
rules: {
'prettier/prettier': 'error',
Expand Down
6 changes: 6 additions & 0 deletions components/Image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import NextImage from 'next/image'

// eslint-disable-next-line jsx-a11y/alt-text
const Image = ({ ...rest }) => <NextImage {...rest} />

export default Image
2 changes: 1 addition & 1 deletion components/MDXComponents.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image'
import Image from './Image'
import CustomLink from './Link'

const MDXComponents = {
Expand Down
8 changes: 3 additions & 5 deletions layouts/ListLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ export default function ListLayout({ posts, title, initialDisplayPosts = [], pag
})}
</ul>
</div>
{pagination &&
pagination.totalPages > 1 &&
!searchValue && (
<Pagination currentPage={pagination.currentPage} totalPages={pagination.totalPages} />
)}
{pagination && pagination.totalPages > 1 && !searchValue && (
<Pagination currentPage={pagination.currentPage} totalPages={pagination.totalPages} />
)}
</>
)
}
9 changes: 8 additions & 1 deletion layouts/PostLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Link from '@/components/Link'
import PageTitle from '@/components/PageTitle'
import SectionContainer from '@/components/SectionContainer'
import { BlogSeo } from '@/components/SEO'
import Image from '@/components/Image'
import Tag from '@/components/Tag'
import siteMetadata from '@/data/siteMetadata'

Expand Down Expand Up @@ -47,7 +48,13 @@ export default function PostLayout({ children, frontMatter, next, prev }) {
<dd>
<ul className="flex justify-center space-x-8 xl:block sm:space-x-12 xl:space-x-0 xl:space-y-8">
<li className="flex items-center space-x-2">
<img src={siteMetadata.image} alt="avatar" className="w-10 h-10 rounded-full" />
<Image
src={siteMetadata.image}
width="38px"
height="38px"
alt="avatar"
className="w-10 h-10 rounded-full"
/>
<dl className="text-sm font-medium leading-5 whitespace-nowrap">
<dt className="sr-only">Name</dt>
<dd className="text-gray-900 dark:text-gray-100">{siteMetadata.author}</dd>
Expand Down
2 changes: 1 addition & 1 deletion lib/mdx.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export async function getAllFilesFrontMatter(folder) {
const fileName = file.slice(prefixPaths.length + 1).replace(/\\/g, '/')
// Remove Unexpected File
if (path.extname(fileName) !== '.md' && path.extname(fileName) !== '.mdx') {
return
return
}
const source = fs.readFileSync(file, 'utf8')
const { data } = matter(source)
Expand Down
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
module.exports = withBundleAnalyzer({
reactStrictMode: true,
pageExtensions: ['js', 'jsx', 'md', 'mdx'],
future: {
webpack5: true,
eslint: {
dirs: ['pages', 'components', 'lib', 'layouts', 'scripts'],
},
webpack: (config, { dev, isServer }) => {
config.module.rules.push({
Expand Down
Loading

0 comments on commit f3433c8

Please sign in to comment.