Skip to content

Commit

Permalink
Fix static build
Browse files Browse the repository at this point in the history
  • Loading branch information
josepjaume committed Sep 16, 2021
1 parent 3284e7d commit be35728
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 14 deletions.
8 changes: 8 additions & 0 deletions components/Image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Image, { ImageProps } from 'next/image'

function CustomImage(props: ImageProps): JSX.Element {
// eslint-disable-next-line jsx-a11y/alt-text, react/jsx-props-no-spreading
return <Image unoptimized {...props} />
}

export default CustomImage
2 changes: 1 addition & 1 deletion components/elements/Button/spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { render, fireEvent, screen } from '@testing-library/react'

// Components
import { Button } from './Button'
import { Button } from './index'

describe('Button', () => {
it('executes the action when button is click', () => {
Expand Down
3 changes: 0 additions & 3 deletions components/index.ts

This file was deleted.

10 changes: 6 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ const nextConfig = {
async headers() {
return [{ source: '/:path*', headers: securityHeaders }]
},
future: {},
i18n: {
defaultLocale: 'en',
locales: ['en'],
images: {
loader: 'custom',
path: '/',
deviceSizes: [320, 480, 768, 1024, 1280, 1440, 1600, 1920, 2048],
imageSizes: [320, 480, 768, 1024, 1280, 1440, 1600, 1920, 2048],
},
future: {},
sassOptions: {
prependData: `@import "styles/variables"; @import "styles/mixins";`,
},
Expand Down
2 changes: 1 addition & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MyDocument extends Document {

render(): JSX.Element {
return (
<Html>
<Html lang="en">
<Head />
<body>
<Main />
Expand Down
6 changes: 3 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ReactElement } from 'react'
import Head from 'next/head'
import Image from '@/components/Image'
import { Button } from '@/components/elements/Button'
import { attributes, react as HomeContent } from '../content/home.md'
import styles from './index.module.scss'
import logo from '@/public/images/logo.jpeg'

export default function Home(): ReactElement {
const { title, items } = attributes
Expand All @@ -16,12 +18,10 @@ export default function Home(): ReactElement {
</Head>

<main className={styles.main}>
<Image src={logo} alt="Codegram's logo" />
<h1 className={styles.title}>{title}</h1>

<Button label="A starter by Codegram" primary />

<HomeContent />

<ul>
{items.map((item) => (
<li key={item.name}>
Expand Down
Binary file added public/images/logo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"@/components": [
"components"
],
"@/components/*": [
"components/*"
"@/*": [
"*"
]
}
},
Expand Down

0 comments on commit be35728

Please sign in to comment.