forked from sashaastiadi/www_mycelium_net
		
	docs: add documentation for download page, 404 page, typography and button components
This commit is contained in:
		
							
								
								
									
										81
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										81
									
								
								README.md
									
									
									
									
									
								
							@@ -148,3 +148,84 @@ To create a new page, follow these steps:
 | 
			
		||||
    ```
 | 
			
		||||
 | 
			
		||||
The new page will be accessible at `http://localhost:3000/new-page`.
 | 
			
		||||
 | 
			
		||||
### Download Page
 | 
			
		||||
 | 
			
		||||
The download page, located at `src/app/(main)/download/page.tsx`, provides users with download links for the Mycelium application across various operating systems. The page is composed of the following components:
 | 
			
		||||
 | 
			
		||||
- **DownloadHero**: Displays the main header and a grid of download cards for each supported platform (iOS, macOS, Windows, Android, and Linux).
 | 
			
		||||
- **DevHub**: Provides links to developer resources, including documentation, support channels, forums, and community groups.
 | 
			
		||||
- **Faqs**: A frequently asked questions section to address common user queries.
 | 
			
		||||
 | 
			
		||||
### Not Found Page
 | 
			
		||||
 | 
			
		||||
The `not-found.tsx` file at `src/app/not-found.tsx` defines a custom 404 error page. This page is displayed whenever a user navigates to a non-existent route. It features a clean and simple layout with a 404 message and a button that directs the user back to the homepage.
 | 
			
		||||
 | 
			
		||||
### Typography with `Texts.tsx`
 | 
			
		||||
 | 
			
		||||
The `src/components/Texts.tsx` file implements a flexible and consistent typography system using a factory pattern. It exports a set of reusable text components, such as `H1`, `P`, and `SectionHeader`, each with predefined styles and color variants.
 | 
			
		||||
 | 
			
		||||
This approach ensures that the visual hierarchy and design language remain consistent throughout the application. To use a text component, simply import it and use it like any other React component:
 | 
			
		||||
 | 
			
		||||
```tsx
 | 
			
		||||
import { H1, P } from '@/components/Texts';
 | 
			
		||||
 | 
			
		||||
function MyComponent() {
 | 
			
		||||
  return (
 | 
			
		||||
    <div>
 | 
			
		||||
      <H1 color="accent">This is a heading</H1>
 | 
			
		||||
      <P color="secondary">This is a paragraph.</P>
 | 
			
		||||
    </div>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Button Components
 | 
			
		||||
 | 
			
		||||
The `src/components/Button.tsx` file provides a polymorphic button component that can be rendered as either a `<button>` or a Next.js `<Link>`. It supports two main variants (`solid` and `outline`) and multiple color schemes.
 | 
			
		||||
 | 
			
		||||
This component is used throughout the application to ensure that all buttons and links have a consistent look and feel. Example usage:
 | 
			
		||||
 | 
			
		||||
```tsx
 | 
			
		||||
import { Button } from '@/components/Button';
 | 
			
		||||
 | 
			
		||||
function MyComponent() {
 | 
			
		||||
  return (
 | 
			
		||||
    <div>
 | 
			
		||||
      <Button variant="solid" color="cyan">Submit</Button>
 | 
			
		||||
      <Button href="/about" variant="outline">Learn More</Button>
 | 
			
		||||
    </div>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Adding Images
 | 
			
		||||
 | 
			
		||||
To add images to the project while ensuring they are optimized, use the Next.js `Image` component. Follow these steps:
 | 
			
		||||
 | 
			
		||||
1.  **Place Your Image**: Add your image file to the `src/images/` directory.
 | 
			
		||||
 | 
			
		||||
2.  **Import the Image**: In the component where you want to display the image, import it at the top of the file:
 | 
			
		||||
 | 
			
		||||
    ```tsx
 | 
			
		||||
    import myImage from '@/images/my-image.png';
 | 
			
		||||
    ```
 | 
			
		||||
 | 
			
		||||
3.  **Use the `Image` Component**: Use the `Image` component from `next/image` to render your image. Provide the `src`, `alt`, `width`, and `height` props for proper rendering and accessibility.
 | 
			
		||||
 | 
			
		||||
    ```tsx
 | 
			
		||||
    import Image from 'next/image';
 | 
			
		||||
    import myImage from '@/images/my-image.png';
 | 
			
		||||
 | 
			
		||||
    export function MyComponent() {
 | 
			
		||||
      return (
 | 
			
		||||
        <Image
 | 
			
		||||
          src={myImage}
 | 
			
		||||
          alt="A descriptive alt text for accessibility"
 | 
			
		||||
          width={500}
 | 
			
		||||
          height={300}
 | 
			
		||||
          priority // Optional: Add this if the image is critical for the initial page load
 | 
			
		||||
        />
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
    ```
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user