+# Document Upload App with Next.js
-# Next.js Enterprise Boilerplate [![GitHub Actions Workflow Status][check-workflow-badge]][check-workflow-badge-link] [![GitHub License][github-license-badge]][github-license-badge-link] [![GitHub contributors][github-contributors-badge]][github-contributors-badge-link] [![Discord][discord-badge]][discord-badge-link] [![Blazity][made-by-blazity-badge]][made-by-blazity-badge-link]
-
-Welcome to the _Next.js Enterprise Boilerplate_, an open-source template for enterprise projects! It's loaded with features that'll help you build a high-performance, maintainable, and enjoyable app. We've done all the heavy lifting for you, so sit back, relax, and get ready to conquer the world with your incredible app! ๐
-
-> [!NOTE]
-> **Blazity** is a group of Next.js/Headless experts. Contact us at [contact@blazity.com](https://blazity.com) if youโd like to talk about your project or just to have a chat with us
+This project is built on the robust foundation of the Next.js Enterprise Boilerplate by Blazity, tailored for a document upload application. It demonstrates advanced usage of Next.js, Formik for form management, Tailwind CSS for styling, and includes comprehensive testing with Jest and Playwright. This README guides you through the project setup, features, and deployment.
## Features
-With this template, you get all the awesomeness you need:
+- **Next.js**: Leveraging the latest features of Next.js for SSR and static generation.
+- **Tailwind CSS**: Utilizing Tailwind for rapid and responsive UI development.
+- **Formik**: Streamlined form handling with validation and custom input components.
+- **Playwright**: End-to-end testing to ensure reliability and functionality.
+- **Radix UI**: Utilizing Radix UI for accessible and customizable components.
+- **Tailwind Merge**: Efficiently managing Tailwind CSS classes.
+- **TypeScript**: Ensuring type safety and developer productivity.
-- ๐๏ธ **[Next.js](https://nextjs.org/)** - Fast by default, with config optimized for performance (with **App Directory**)
-- ๐
**[Tailwind CSS](https://tailwindcss.com/)** - A utility-first CSS framework for rapid UI development
-- โจ **[ESlint](https://eslint.org/)** and **[Prettier](https://prettier.io/)** - For clean, consistent, and error-free code
-- ๐ ๏ธ **[Extremely strict TypeScript](https://www.typescriptlang.org/)** - With [`ts-reset`](https://github.com/total-typescript/ts-reset) library for ultimate type safety
-- ๐ **[GitHub Actions](https://github.com/features/actions)** - Pre-configured actions for smooth workflows, including Bundle Size and performance stats
-- ๐ฏ **Perfect Lighthouse score** - Because performance matters
-- **[Bundle analyzer plugin](https://www.npmjs.com/package/@next/bundle-analyzer)** - Keep an eye on your bundle size
-- **[Jest](https://jestjs.io/)** and **[React Testing Library](https://testing-library.com/react)** - For rock-solid unit and integration tests
-- **[Playwright](https://playwright.dev/)** - Write end-to-end tests like a pro
-- **[Storybook](https://storybook.js.org/)** - Create, test, and showcase your components
-- **Smoke Testing** and **Acceptance Tests** - For confidence in your deployments
-- **[Conventional commits git hook](https://www.conventionalcommits.org/)** - Keep your commit history neat and tidy
-- **[Observability](https://opentelemetry.io/)** - Open Telemetry integration for seamless monitoring
-- **[Absolute imports](https://nextjs.org/docs/advanced-features/module-path-aliases)** - No more spaghetti imports
-- **[Health checks](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)** - Kubernetes-compatible for robust deployments
-- **[Radix UI](https://www.radix-ui.com/)** - Headless UI components for endless customization
-- **[CVA](http://cva.style/)** - Create a consistent, reusable, and atomic design system
-- **[Renovate BOT](https://www.whitesourcesoftware.com/free-developer-tools/renovate)** - Auto-updating dependencies, so you can focus on coding
-- **[Patch-package](https://www.npmjs.com/package/patch-package)** - Fix external dependencies without losing your mind
-- **Components coupling and cohesion graph** - A tool for managing component relationships
-- **[Automated ChatGPT Code Reviews](https://openai.com/chatgpt)** - **Stay on the cutting edge with AI-powered code reviews!**
-- **[Semantic Release](https://github.com/semantic-release/semantic-release)** - for automatic changelog
-- **[T3 Env](https://env.t3.gg/)** - Manage your environment variables with ease
+## Getting Started
-## Table of Contents
+To run this project locally, follow these steps:
-- [Next.js Enterprise Boilerplate](#nextjs-enterprise-boilerplate)
- - [Features](#features)
- - [Table of Contents](#table-of-contents)
- - [Getting Started](#-getting-started)
- - [Deployment](#-deployment)
- - [Scripts Overview](#-scripts-overview)
- - [Coupling Graph](#-coupling-graph)
- - [Testing](#-testing)
- - [Running Tests](#running-tests)
- - [Acceptance Tests](#acceptance-tests)
- - [Smoke Testing](#smoke-testing)
- - [Styling and Design System](#-styling-and-design-system)
- - [CVA - A New Approach to Variants](#cva---a-new-approach-to-variants)
- - [State Management](#-state-management)
- - [Zustand](#zustand)
- - [Jotai](#jotai)
- - [Recoil](#recoil)
- - [ChatGPT Code Review](#-chatgpt-code-review)
- - [Environment Variables handling](#-environment-variables-handling)
- - [Contribution](#-contribution)
- - [Support](#support)
- - [License](#-license)
- - [Contributors](#contributors)
-
-## ๐ฏ Getting Started
-
-To get started with this boilerplate, follow these steps:
-
-1. Fork & clone repository:
+1. Clone the repository:
```bash
-## Don't forget to โญ star and fork it first :)
-git clone https://github.com/
-
-Bart Stefanski ๐ป |
- Jakub Jabลoลski ๐ |
- Igor Klepacki ๐ |
- ||||
|
- |
- ||||||
{error}
+ return{error}
} return null } diff --git a/components/Form/FileInput.tsx b/components/Form/FileInput.tsx index 25b7a3b..29a058d 100644 --- a/components/Form/FileInput.tsx +++ b/components/Form/FileInput.tsx @@ -1,64 +1,146 @@ +/** + * FileInput Component + * + * Renders a file input with drag-and-drop support. Displays the selected file's name and size, + * and simulates file upload progress. Integrates with Formik for form state management. + */ + +import { faFile } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useField, useFormikContext } from "formik"; -import React, { useRef } from "react"; +import React, { useRef, useState } from "react"; import ErrorMessage from "./ErrorMessage"; import RequiredAsterisk from "./RequiredAsterisk"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faFile } from "@fortawesome/free-solid-svg-icons"; - +import Separator from "./Separator"; interface FileInputProps { label: string; required?: boolean; - name:string; + name: string; } -const FileInput: React.FC{fileInfo.name}
+{Math.round(fileInfo.size / 1024)} KB
+