This is my implementation of the Single-page developer portfolio.
Users should be able to:
- Receive an error message when the
formis submitted if:- Any field is empty
- The email address is not formatted correctly
- View the optimal layout for the interface depending on their device's screen size
- See hover states for all interactive elements on the page
- When the user clicks the
Contact mein the hero or projects section, the browser should scroll down to the contact form.
- React - JS library
- Next.js - React framework
- Styled Components - For styles
- CSS Flexbox
- CSS Grid
- useRef hook
I switched to styled-components for styling in the Next.js project just to make sure I get myself acquainted with CSS-in-JS registry configuration in Next.js 14+ and createGlobalStyle API of styled-components.
'use client';
import React, { useState } from 'react';
import { useServerInsertedHTML } from 'next/navigation';
import {
ServerStyleSheet,
StyleSheetManager,
} from 'styled-components';
export default function StyledComponentsRegistry({ children }) {
const [styledComponentsStyleSheet] = useState(
() => new ServerStyleSheet()
);
useServerInsertedHTML(() => {
const styles = styledComponentsStyleSheet.getStyleElement();
styledComponentsStyleSheet.instance.clearTag();
return <>{styles}</>;
});
if (typeof window !== 'undefined') return <>{children}</>;
return (
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}>
{children}
</StyleSheetManager>
);
}- Injecting a Line Break - This helped me for implementing the injecting of a line break.
- Website - Jett Zhang
