Skip to content

Commit

Permalink
fix: Poprawiono błąd w nawigacji i stopce (#80)
Browse files Browse the repository at this point in the history
* fix: Poprawiono błąd w nawigacji

* Remove stupid code
  • Loading branch information
Michał Miszczyszyn committed Dec 29, 2020
1 parent 33c0f9c commit 94319e2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/ArticleSection/ArticleSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Button } from '../Button/Button';

import styles from './articleSection.module.scss';

type ArticleSectionProps = ArticlePageProps;
type ArticleSectionProps = Pick<ArticlePageProps, 'article'>;

export const ArticleSection = memo<ArticleSectionProps>(({ article }) => {
const readableDate = formatDate(article.publishedAt);
Expand Down
4 changes: 2 additions & 2 deletions components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Link from 'next/link';
import styles from './footer.module.scss';

const date = new Date();
const footerDate = date.toISOString();
const copyrightYear = date.getFullYear();

export const Footer = () => {
Expand All @@ -22,9 +21,10 @@ export const Footer = () => {
</a>
</Link>{' '}
<span aria-hidden={true} className={styles.version}>
{process.env.NEXT_PUBLIC_VERSION || ''} <time>{footerDate}</time>
{process.env.NEXT_PUBLIC_VERSION || ''}
</span>
</p>
</footer>
);
};
Footer.displayName = 'Footer';
15 changes: 11 additions & 4 deletions components/MainNavigation/MainNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ export const MainNavigation = () => {
<ul className={styles.navigationList}>
{links.map(({ label, href, openInNewTab, icon }) => (
<li className={styles.navigationItem} key={href}>
<Link href={href}>
<a {...(openInNewTab && { target: '_blank' })} title={label}>
<span className={`icon-${icon} ${styles.icon}`}></span>
{openInNewTab ? (
<a href={href} target="_blank" rel="noopener noreferrer" title={label}>
<span className={`icon-${icon} ${styles.icon}`} />
<span className={styles.label}>{label}</span>
</a>
</Link>
) : (
<Link href={href}>
<a title={label}>
<span className={`icon-${icon} ${styles.icon}`} />
<span className={styles.label}>{label}</span>
</a>
</Link>
)}
</li>
))}
</ul>
Expand Down
6 changes: 5 additions & 1 deletion pages/[displayStyle]/[cursor].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ export const getStaticProps = async ({
const { data: articlesFromDb, nextCursor } = await getArticlesForList(prisma, params?.cursor);
const articles = articlesFromDb.map(addExcerptToArticle);
return {
props: { articles, displayStyle: 'list' as const, nextCursor },
props: {
articles,
displayStyle: 'list' as const,
nextCursor,
},
revalidate: REVALIDATION_TIME,
};
}
Expand Down
2 changes: 1 addition & 1 deletion types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ export type InferGetStaticPropsContext<T> = GetStaticPropsContext<InferGetStatic

export type InferGetStaticPropsType2<T> = T extends (
...args: readonly any[]
) => Promise<{ readonly props: infer P }>
) => Promise<{ readonly props: infer P }> | { readonly props: infer P }
? NonNullable<P>
: never;

0 comments on commit 94319e2

Please sign in to comment.