mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-01 18:00:26 +00:00
Update dependencies and fix introduced errors
This commit is contained in:
Vendored
+5
-28
@@ -1,37 +1,14 @@
|
||||
declare module '@mdx-js/react' {
|
||||
import * as React from 'react';
|
||||
type ComponentType =
|
||||
| 'a'
|
||||
| 'blockquote'
|
||||
| 'code'
|
||||
| 'del'
|
||||
| 'em'
|
||||
| 'h1'
|
||||
| 'h2'
|
||||
| 'h3'
|
||||
| 'h4'
|
||||
| 'h5'
|
||||
| 'h6'
|
||||
| 'hr'
|
||||
| 'img'
|
||||
| 'inlineCode'
|
||||
| 'li'
|
||||
| 'ol'
|
||||
| 'p'
|
||||
| 'pre'
|
||||
| 'strong'
|
||||
| 'sup'
|
||||
| 'table'
|
||||
| 'td'
|
||||
| 'thematicBreak'
|
||||
| 'tr'
|
||||
| 'ul';
|
||||
|
||||
export type Components = {
|
||||
[key in ComponentType]?: React.ComponentType<any>;
|
||||
[key]?: React.ComponentType<any>;
|
||||
};
|
||||
|
||||
export interface MDXProviderProps {
|
||||
children: React.ReactNode;
|
||||
components: Components;
|
||||
components?: Components;
|
||||
}
|
||||
|
||||
export class MDXProvider extends React.Component<MDXProviderProps> {}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
import { FC, useContext } from 'react';
|
||||
import { ThemeContext } from '../../styles/theme';
|
||||
import { Props } from './types';
|
||||
import { Btn } from './styles';
|
||||
import Link from 'next/link';
|
||||
import { StyledButton } from './styles';
|
||||
|
||||
const Button: FC<Props & { className?: string }> = ({
|
||||
const Button = ({
|
||||
variant = 'text',
|
||||
href,
|
||||
target,
|
||||
onClick,
|
||||
children,
|
||||
className
|
||||
}) => {
|
||||
return (
|
||||
<Link href={href} passHref>
|
||||
<Btn as='a' target={target} variant={variant} onClick={onClick} className={className}>
|
||||
}: Props) => (
|
||||
<StyledButton href={href} target={target} className={className} onClick={onClick} variant={variant}>
|
||||
{children}
|
||||
</Btn>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
</StyledButton>
|
||||
);
|
||||
|
||||
export default Button;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import styled from 'styled-components';
|
||||
import Link from 'next/link';
|
||||
import { Props } from './types';
|
||||
|
||||
export const Btn = styled.button<Omit<Props, 'href'>>`
|
||||
export const StyledButton = styled(Link)<Props>`
|
||||
position: relative;
|
||||
display: inline;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -3,4 +3,6 @@ export type Props = {
|
||||
href: string;
|
||||
target?: HTMLAnchorElement['target'];
|
||||
onClick?: () => void;
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { FC } from 'react';
|
||||
import { StyledCard } from './styles';
|
||||
import Image from 'next/image';
|
||||
import Link from 'next/link';
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
@@ -15,8 +14,7 @@ interface Props {
|
||||
|
||||
const Card: FC<Props> = ({ title, description, image, tags, href, target, onClick }) => {
|
||||
return (
|
||||
<Link href={href} passHref>
|
||||
<StyledCard as='a' target={target} onClick={onClick} image={!!image}>
|
||||
<StyledCard href={href} onClick={onClick} image={!!image} target={target}>
|
||||
<div className='card-content'>
|
||||
<h3>{title}</h3>
|
||||
<p>{description}</p>
|
||||
@@ -30,11 +28,10 @@ const Card: FC<Props> = ({ title, description, image, tags, href, target, onClic
|
||||
</div>
|
||||
{image && (
|
||||
<div className='card-image'>
|
||||
<Image src={image} layout='fill' objectFit='cover' />
|
||||
<Image alt={title} src={image} fill />
|
||||
</div>
|
||||
)}
|
||||
</StyledCard>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import styled from 'styled-components';
|
||||
import Link from 'next/link';
|
||||
|
||||
export const StyledCard = styled.div<{ image: boolean }>`
|
||||
export const StyledCard = styled(Link)<{ image: boolean }>`
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
display: grid;
|
||||
|
||||
@@ -3,7 +3,7 @@ import Highlight, { defaultProps, Language } from 'prism-react-renderer';
|
||||
import theme from 'prism-react-renderer/themes/vsDark';
|
||||
import { Line, LineContent, LineNo, Pre } from './styles';
|
||||
|
||||
const CodeBlock: FC<{ className: string }> = ({ children, className }) => {
|
||||
const CodeBlock: FC<{ className: string, children: React.ReactNode }> = ({ children, className }) => {
|
||||
const language = className.replace(/language-/, '') as Language;
|
||||
|
||||
return (
|
||||
|
||||
@@ -67,6 +67,10 @@ const GlobalStyles = createGlobalStyle`
|
||||
body::-webkit-scrollbar-thumb {
|
||||
background-color: var(--text) !important;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
`;
|
||||
|
||||
export default GlobalStyles;
|
||||
|
||||
@@ -12,7 +12,7 @@ interface Props {
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
const Btn = styled.button`
|
||||
const Btn = styled(Link)`
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: none;
|
||||
@@ -30,15 +30,13 @@ const IconButton: FC<Props & { className?: string }> = ({
|
||||
height = 24
|
||||
}) => {
|
||||
return !href ? (
|
||||
<Btn onClick={onClick} className={className}>
|
||||
<Image src={icon} width={width} height={height} />
|
||||
<Btn href='#' onClick={onClick} className={className}>
|
||||
<Image alt='' src={icon} width={width} height={height} />
|
||||
</Btn>
|
||||
) : (
|
||||
<Link href={href} passHref>
|
||||
<Btn as='a' target={target} onClick={onClick} className={className}>
|
||||
<Image src={icon} width={width} height={height} />
|
||||
<Btn href={href} target={target} onClick={onClick} className={className}>
|
||||
<Image alt='' src={icon} width={width} height={height} />
|
||||
</Btn>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { FC, useContext } from 'react';
|
||||
import { useContext } from 'react';
|
||||
import { ThemeContext } from '../../styles/theme';
|
||||
import { Props } from './types';
|
||||
import { Btn } from './styles';
|
||||
import Link from 'next/link';
|
||||
|
||||
const MDXButton: FC<Props & { className?: string }> = ({
|
||||
const MDXButton = ({
|
||||
variant = 'text',
|
||||
type = 'button',
|
||||
link,
|
||||
@@ -12,13 +11,12 @@ const MDXButton: FC<Props & { className?: string }> = ({
|
||||
children,
|
||||
disabled,
|
||||
className
|
||||
}) => {
|
||||
}: Props) => {
|
||||
const { mode } = useContext(ThemeContext);
|
||||
|
||||
return link ? (
|
||||
<Link href={link} passHref>
|
||||
<Btn
|
||||
as='a'
|
||||
href={link}
|
||||
target={target}
|
||||
variant={variant}
|
||||
type={type}
|
||||
@@ -28,9 +26,8 @@ const MDXButton: FC<Props & { className?: string }> = ({
|
||||
>
|
||||
{children}
|
||||
</Btn>
|
||||
</Link>
|
||||
) : (
|
||||
<Btn variant={variant} type={type} mode={mode} disabled={disabled} className={className}>
|
||||
<Btn href="#" variant={variant} type={type} mode={mode} disabled={disabled} className={className}>
|
||||
{children}
|
||||
</Btn>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import Link from 'next/link';
|
||||
import styled from 'styled-components';
|
||||
import { Props } from './types';
|
||||
|
||||
export const Btn = styled.button<Props>`
|
||||
export const Btn = styled(Link)<Props>`
|
||||
cursor: pointer;
|
||||
display: ${({ variant }) =>
|
||||
['action', 'outline'].includes(variant as string) ? 'block' : 'inline'};
|
||||
|
||||
@@ -5,4 +5,6 @@ export type Props = {
|
||||
target?: HTMLAnchorElement['target'];
|
||||
mode?: string;
|
||||
disabled?: boolean;
|
||||
className?: string;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
@@ -13,8 +13,7 @@ const Nav: FC = () => {
|
||||
|
||||
return (
|
||||
<Bar>
|
||||
<Link href='/' passHref>
|
||||
<a className='logo'>
|
||||
<Link className='logo' href='/'>
|
||||
<Image
|
||||
className='logo-image'
|
||||
src={mode === 'dark' ? '/light-logo.svg' : '/dark-logo.svg'}
|
||||
@@ -23,7 +22,6 @@ const Nav: FC = () => {
|
||||
height={48}
|
||||
/>
|
||||
<h1>Hazem Krimi</h1>
|
||||
</a>
|
||||
</Link>
|
||||
<div className='buttons'>
|
||||
<IconButton
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { CodePen, Gist, YouTube, CodeSandbox, Vimeo, Tweet } from 'mdx-embed';
|
||||
import Image from 'next/image';
|
||||
import MDXButton from './MDXButton';
|
||||
|
||||
export default {
|
||||
Button: MDXButton,
|
||||
Image,
|
||||
CodePen,
|
||||
Gist,
|
||||
Vimeo,
|
||||
CodeSandbox,
|
||||
Tweet,
|
||||
YouTube
|
||||
};
|
||||
+4
-1
@@ -1,5 +1,8 @@
|
||||
const withMDX = require('@next/mdx')({
|
||||
extension: /\.mdx?$/
|
||||
extension: /\.mdx?$/,
|
||||
options: {
|
||||
providerImportSource: '@mdx-js/react'
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = withMDX({
|
||||
|
||||
+17
-17
@@ -8,28 +8,28 @@
|
||||
"start": "next start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@formspree/react": "^2.2.3",
|
||||
"@mdx-js/loader": "^1.6.22",
|
||||
"@next/mdx": "^12.0.8",
|
||||
"gray-matter": "^4.0.2",
|
||||
"mdx-embed": "^0.0.22",
|
||||
"next": "^12.0.8",
|
||||
"next-mdx-remote": "^3.0.8",
|
||||
"@formspree/react": "^2.4.1",
|
||||
"@mdx-js/loader": "^2.3.0",
|
||||
"@next/mdx": "^13.2.4",
|
||||
"gray-matter": "^4.0.3",
|
||||
"mdx-embed": "^1.1.2",
|
||||
"next": "^13.2.4",
|
||||
"next-mdx-remote": "^4.4.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"prism-react-renderer": "^1.1.1",
|
||||
"react": "17.0.2",
|
||||
"react-dom": "17.0.2",
|
||||
"reading-time": "^1.4.0",
|
||||
"styled-components": "^5.2.1"
|
||||
"prism-react-renderer": "^1.3.5",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"reading-time": "^1.5.0",
|
||||
"styled-components": "^5.3.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^17.0.8",
|
||||
"@types/node": "^18.15.3",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@types/react": "^17.0.38",
|
||||
"@types/styled-components": "^5.1.20",
|
||||
"babel-plugin-styled-components": "^2.0.2",
|
||||
"@types/react": "^18.0.28",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"babel-plugin-styled-components": "^2.0.7",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"typescript": "^4.5.4"
|
||||
"typescript": "^5.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.x"
|
||||
|
||||
@@ -8,7 +8,6 @@ import { GetStaticPaths, GetStaticProps } from 'next';
|
||||
import { serialize } from 'next-mdx-remote/serialize';
|
||||
import { Wrapper } from '../../styles/blog/slug';
|
||||
import matter from 'gray-matter';
|
||||
import components from '../../components';
|
||||
import Head from 'next/head';
|
||||
import IconButton from '../../components/IconButton';
|
||||
import CodeBlock from '../../components/CodeBlock';
|
||||
@@ -24,6 +23,8 @@ interface Props {
|
||||
const BlogPost: FC<Props> = ({ source, frontMatter, text }) => {
|
||||
const router = useRouter();
|
||||
const stats = readingTime(text);
|
||||
const htmlOverrides = { code: CodeBlock };
|
||||
const mdxComponents = {};
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
@@ -83,15 +84,15 @@ const BlogPost: FC<Props> = ({ source, frontMatter, text }) => {
|
||||
) : null}
|
||||
{frontMatter?.image ? (
|
||||
<div className='image'>
|
||||
<Image src={frontMatter.image} width='100%' height='100%' layout='responsive' />
|
||||
<Image alt={frontMatter?.title} src={frontMatter.image} fill />
|
||||
</div>
|
||||
) : null}
|
||||
<hr />
|
||||
</div>
|
||||
<MDXProvider components={{ code: CodeBlock }}>
|
||||
<MDXProvider components={{ ...htmlOverrides, ...mdxComponents }}>
|
||||
<MDXEmbedProvider>
|
||||
<div className='content'>
|
||||
<MDXRemote {...source} components={components} />
|
||||
<MDXRemote {...source} />
|
||||
</div>
|
||||
</MDXEmbedProvider>
|
||||
</MDXProvider>
|
||||
|
||||
@@ -3,11 +3,9 @@ import { getPortfolioPorjectsSlugs, getPortfolioProjectdata } from '../../utils/
|
||||
import { useRouter } from 'next/router';
|
||||
import { MDXRemote, MDXRemoteSerializeResult } from 'next-mdx-remote';
|
||||
import { MDXProvider } from '@mdx-js/react';
|
||||
import { MDXEmbedProvider } from 'mdx-embed';
|
||||
import { GetStaticPaths, GetStaticProps } from 'next';
|
||||
import { serialize } from 'next-mdx-remote/serialize';
|
||||
import matter from 'gray-matter';
|
||||
import components from '../../components';
|
||||
import { Wrapper } from '../../styles/portfolio/slug';
|
||||
import Head from 'next/head';
|
||||
import IconButton from '../../components/IconButton';
|
||||
@@ -22,6 +20,8 @@ interface Props {
|
||||
|
||||
const PortfolioProject: FC<Props> = ({ source, frontMatter }) => {
|
||||
const router = useRouter();
|
||||
const htmlOverrides = { code: CodeBlock };
|
||||
const mdxComponents = { Button: MDXButton };
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
@@ -78,15 +78,14 @@ const PortfolioProject: FC<Props> = ({ source, frontMatter }) => {
|
||||
) : null}
|
||||
{frontMatter?.image && !frontMatter?.hideImage ? (
|
||||
<div className='image'>
|
||||
<Image src={frontMatter?.image} width='100%' height='100%' layout='responsive' />
|
||||
<Image alt={frontMatter?.title} src={frontMatter?.image} fill />
|
||||
</div>
|
||||
) : null}
|
||||
<hr />
|
||||
</div>
|
||||
<MDXProvider components={{ code: CodeBlock }}>
|
||||
<MDXEmbedProvider>
|
||||
<MDXProvider components={{ ...htmlOverrides, ...mdxComponents }}>
|
||||
<div className='content'>
|
||||
<MDXRemote {...source} components={components} />
|
||||
<MDXRemote {...source} />
|
||||
<h1>Showcase</h1>
|
||||
<div className='showcase-buttons'>
|
||||
<MDXButton variant='action' link={frontMatter?.demo} target='_blank'>
|
||||
@@ -97,7 +96,6 @@ const PortfolioProject: FC<Props> = ({ source, frontMatter }) => {
|
||||
</MDXButton>
|
||||
</div>
|
||||
</div>
|
||||
</MDXEmbedProvider>
|
||||
</MDXProvider>
|
||||
</Wrapper>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user