Part 1 : Design a Custom File Manager Using HTML and CSS

0
94

File management applications are crucial for handling and organizing digital assets. While many ready-made solutions exist, creating a custom file manager tailored to specific needs offers flexibility, better integration, and a deeper understanding of web technologies. This article explores designing a custom file manager using HTML and CSS.

Part 1 : Design a Custom File Manager Using HTML and CSS

Part 2 : Creating a Dynamic File Manager with PHP

Part 3 : Enhancing the File Manager with a File Upload Feature

Why Build a Custom File Manager?

Creating a custom file manager has several advantages:

  • Tailored Functionality: Customize features specific to your workflow.
  • Better Integration: Seamlessly integrate with existing web applications.
  • Learning Opportunity: Deepen your knowledge of front-end development.
  • Enhanced UI/UX: Design an intuitive interface that suits your users.

Follow this video for complete guidance:

Complete Source Code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Custom File Manager</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f7f7f7;
        }
        .container {
            max-width: 1200px;
        }
        .breadcrumb {
            background-color: transparent;
            padding: 0;
            margin-bottom: 20px;
        }
        .breadcrumb a {
            color: #007bff;
            text-decoration: none;
            font-weight: bold;
            font-size: 16px;
            transition: color 0.3s ease;
        }
        .breadcrumb a:hover {
            color: #0056b3;
            text-decoration: underline;
        }
        .breadcrumb i {
            color: #6c757d;
        }
        .breadcrumb-item {
            font-size: 16px;
            color: #6c757d;
        }
        .breadcrumb-separator {
            color: #6c757d;
            padding: 0 8px;
        }
        .sidebar {
            background-color: #343a40;
            color: #fff;
            padding: 20px;
            height: 100vh;
            position: fixed;
            top: 0;
            left: 0;
            width: 250px;
        }
        .sidebar-item {
            margin-bottom: 10px;
            cursor: pointer;
            font-size: 16px;
        }
        .sidebar-item:hover {
            background-color: #495057;
            padding-left: 10px;
            transition: padding 0.3s;
        }
        .content {
            margin-left: 270px;
            padding: 20px;
        }
        .file-item {
            background-color: #fff;
            border-radius: 5px;
            padding: 15px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            margin-bottom: 15px;
            text-align: center;
        }
        .file-item:hover {
            background-color: #e9ecef;
        }
        .file-icon i {
            font-size: 40px;
            color: #6c757d;
            margin-bottom: 10px;
        }
        .file-name {
            font-size: 14px;
            color: #495057;
        }
        .file-actions {
            margin-top: 10px;
        }
        #contextMenu {
            display: none;
            position: absolute;
            background-color: #ffffff;
            border: 1px solid #ccc;
            box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
            border-radius: 4px;
            z-index: 1000;
        }
        #contextMenu .menu-item {
            padding: 8px 12px;
            cursor: pointer;
        }
        #contextMenu .menu-item:hover {
            background-color: #f1f1f1;
        }
        .upload-area {
            width: 400px; height: 200px;
            border: 2px dashed #ccc; border-radius: 10px;
            text-align: center; line-height: 200px;
            margin: 50px auto; cursor: pointer;
            color: #333; font-size: 18px;
        }
        .upload-area.hover { background: #f0f0f0; }
        #fileInput { display: none; }
    </style>
</head>
<body>
    <div class="sidebar">
        <h4 class="text-center">File Manager</h4>
        <hr class="text-white">
        <div class="sidebar-item">
          <strong>Quick Access</strong>
        </div>
        <div class="sidebar-item">
            <a href="" class="text-white">Audio</a>
        </div>
        <div class="sidebar-item">
            <a href="" class="text-white">Documents</a>
        </div>
        <div class="sidebar-item">
            <a href="" class="text-white">Images</a>
        </div>
        <div class="sidebar-item">
            <a href="" class="text-white">Others</a>
        </div>
        <div class="sidebar-item">
            <a href="" class="text-white">Videos</a>
        </div>
    </div>

    <div class="content">
        <div class="container">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item">
                      <a href="">Home</a>
                    </li>
                    <li class="breadcrumb-item">
                      <a href="">Documents</a>
                    </li>
                    <li class="breadcrumb-item">
                      <a href="">Uploads</a>
                    </li>
        </ol>
            </nav>

      <div class="upload-area">Drag & Drop Files Here</div>

            <div class="row mt-5">
                <div class="col-md-2">
                    <div class="file-item" oncontextmenu="showContextMenu(event, 'Audio')">
                        <a href="" class="text-decoration-none text-dark">
                            <div class="file-icon">
                                <i class="fa fa-folder"></i>
                            </div>
                            <div class="file-name">Audio</div>
                        </a>
                    </div>
                </div>
        <div class="col-md-2">
          <div class="file-item" oncontextmenu="showContextMenu(event, 'Documents')">
            <a href="" class="text-decoration-none text-dark">
              <div class="file-icon">
                <i class="fa fa-folder"></i>
              </div>
              <div class="file-name">Documents</div>
            </a>
          </div>
                </div>
              <div class="col-md-2">
                    <div class="file-item" oncontextmenu="showContextMenu(event, 'Images')">
                        <a href="" class="text-decoration-none text-dark">
                            <div class="file-icon">
                                <i class="fa fa-folder"></i>
                            </div>
                            <div class="file-name">Images</div>
                        </a>
                    </div>
                </div>
                <div class="col-md-2">
                    <div class="file-item" oncontextmenu="showContextMenu(event, 'Others')">
                        <a href="" class="text-decoration-none text-dark">
                            <div class="file-icon">
                                <i class="fa fa-folder"></i>
                            </div>
                          <div class="file-name">Others</div>
                        </a>
                    </div>
                </div>
                <div class="col-md-2" id="file-Videos">
                    <div class="file-item" oncontextmenu="showContextMenu(event, 'Videos')">
                        <a href="" class="text-decoration-none text-dark">
                            <div class="file-icon">
                                <i class="fa fa-folder"></i>
                            </div>
                            <div class="file-name">Videos</div>
                        </a>
                    </div>
                </div>
                <div class="col-2 text-center">
                <div class="file-item" oncontextmenu="showContextMenu(event, 'image.png')">
                  <div class="file-icon">
                    <i class="fa fa-image"></i>
                  </div>
                      <span>image.png</span>
                  </div>
              </div>
              <div class="col-2 text-center">
                <div class="file-item" oncontextmenu="showContextMenu(event, 'audio.mp3')">
                  <div class="file-icon">
                    <i class="fa fa-play"></i>
                  </div>
                      <span>audio.mp3</span>
                  </div>
              </div>
              <div class="col-2 text-center">
                <div class="file-item" oncontextmenu="showContextMenu(event, 'video.mp4')">
                  <div class="file-icon">
                    <i class="fa fa-video"></i>
                  </div>
                      <span>video.mp4</span>
                  </div>
              </div>
              <div class="col-2 text-center">
                <div class="file-item" oncontextmenu="showContextMenu(event, 'file.pdf')">
                  <div class="file-icon">
                    <i class="fa fa-file"></i>
                  </div>
                      <span>file.pdf</span>
                  </div>
              </div>
            </div>

            <div id="contextMenu" class="context-menu">
                <div class="menu-item">Rename</div>
                <div class="menu-item">Delete</div>
            </div>
        </div>
    </div>

    <script>
        function showContextMenu(event, file) {
            event.preventDefault();
            currentItem = file;
            const contextMenu = document.getElementById('contextMenu');
            contextMenu.style.display = 'block';
            contextMenu.style.left = `${event.pageX}px`;
            contextMenu.style.top = `${event.pageY}px`;
        }

        function hideContextMenu() {
            document.getElementById('contextMenu').style.display = 'none';
        }

        window.addEventListener('click', hideContextMenu);   
    </script>
</body>
</html>

Core Design Elements

A clean and organized layout is key to an effective file manager. Divide the interface into a sidebar for quick access links and a content area for file displays.

  • Sidebar: Contains quick access links like Audio, Documents, Images, Videos, and Others.
  • Content Area: Displays files and folders in a grid format with relevant icons.
ALSO READ  Rotating Border Animation using CSS

File Display Cards

Each file or folder is displayed as a card with:

  • Icon Representation: Icons corresponding to file types (folders, images, videos, etc.).
  • File Name: Clear and descriptive file names.
  • Interactive Features: Hover effects for better UX.

Context Menu for Actions

Right-click context menus allow file actions such as:

  • Rename: Modify file names on the fly.
  • Delete: Remove unwanted files easily.

Key Design Considerations

  • Visual Hierarchy: Use different text sizes, bold fonts, and colors for a clear information structure.
  • Accessibility: Ensure keyboard navigation and screen reader support.
  • Responsive Design: Make the interface adaptable across devices.
  • User Feedback: Provide hover effects, active state indicators, and confirmation messages.

Styling Best Practices

  • Consistent Theme: Stick to a consistent color scheme that reflects simplicity and professionalism.
  • Modern Aesthetics: Use shadows, rounded corners, and minimalistic icons for a modern look.
  • Typography: Choose readable fonts with appropriate sizes for headings and content.
  • Whitespace Management: Ensure enough padding and margins for a clean appearance.

Enhancing User Experience

  • Drag & Drop Uploads: Enable drag-and-drop functionality for file uploads.
  • Search & Filter: Implement a search bar for quick file retrieval.
  • File Previews: Provide thumbnail previews for images and documents.
  • Responsive Adjustments: Make the design mobile-friendly with CSS media queries.

Building a custom file manager using HTML and CSS is an exciting project that boosts both development skills and creative design capabilities. It opens doors to further customization, such as integrating JavaScript for file handling, back-end logic for file storage, and cloud integration for expanded file management capabilities.

Start building your custom file manager today and transform how you manage digital content!

ALSO READ  Build a simple Calendar in Website using PHP (With Source Code)

Comments are closed.