Skip to content

Latest commit

Β 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Portfolio Website - Modular Architecture

A robust, modular portfolio website built with vanilla JavaScript, following modern component-based architecture principles similar to React/Vue, but without any frameworks.

πŸ“ Project Structure

yograj/
β”œβ”€β”€ index.html              # Main HTML entry point
β”œβ”€β”€ style.css               # Main stylesheet (imports all CSS modules)
β”œβ”€β”€ app.js                  # Legacy app.js (kept for reference)
β”‚
β”œβ”€β”€ components/             # HTML Component Templates
β”‚   β”œβ”€β”€ Header.html
β”‚   β”œβ”€β”€ Hero.html
β”‚   β”œβ”€β”€ About.html
β”‚   β”œβ”€β”€ Experience.html
β”‚   β”œβ”€β”€ Projects.html
β”‚   └── Skills.html
β”‚
β”œβ”€β”€ js/                     # JavaScript Modules
β”‚   β”œβ”€β”€ app.js             # Main application entry point
β”‚   β”‚
β”‚   β”œβ”€β”€ core/              # Core framework files
β”‚   β”‚   β”œβ”€β”€ Component.js   # Component base class & template engine
β”‚   β”‚   └── Router.js      # Router for navigation
β”‚   β”‚
β”‚   β”œβ”€β”€ components/        # Component classes
β”‚   β”‚   β”œβ”€β”€ Navigation.js
β”‚   β”‚   β”œβ”€β”€ Hero.js
β”‚   β”‚   β”œβ”€β”€ About.js
β”‚   β”‚   β”œβ”€β”€ Experience.js
β”‚   β”‚   β”œβ”€β”€ Projects.js
β”‚   β”‚   └── Skills.js
β”‚   β”‚
β”‚   └── utils/              # Utility functions
β”‚       β”œβ”€β”€ dom.js         # DOM manipulation helpers
β”‚       └── animations.js  # Animation utilities
β”‚
β”œβ”€β”€ css/                    # CSS Modules
β”‚   β”œβ”€β”€ base.css           # Variables, reset, global styles
β”‚   β”œβ”€β”€ navigation.css
β”‚   β”œβ”€β”€ hero.css
β”‚   β”œβ”€β”€ about.css
β”‚   β”œβ”€β”€ experience.css
β”‚   β”œβ”€β”€ projects.css
β”‚   β”œβ”€β”€ skills.css
β”‚   └── scroll-progress.css
β”‚
└── data/                   # Data files
    └── portfolio.js       # Centralized portfolio data

πŸš€ Features

Component-Based Architecture

  • Reusable Components: Each section is a separate component
  • Template Engine: Simple templating system with {{variable}} and {{#each}} syntax
  • Lifecycle Hooks: Components support onMount() and onUnmount() hooks
  • State Management: Components can manage their own state

Modular CSS

  • Component-Based Styles: Each component has its own CSS file
  • Easy Maintenance: Update styles without affecting other components
  • Organized Structure: Clear separation of concerns

Data-Driven

  • Centralized Data: All portfolio data in data/portfolio.js
  • Easy Updates: Update content in one place
  • Type-Safe: Clear data structure

Utilities

  • DOM Helpers: Simplified DOM manipulation
  • Animation Utilities: Reusable animation functions
  • Router: Navigation handling (ready for future expansion)

πŸ› οΈ Getting Started

Running Locally

Since this uses ES6 modules, you need to run it through a local server:

Option 1: Using Python

# Python 3
python3 -m http.server 8000

# Python 2
python -m SimpleHTTPServer 8000

Option 2: Using Node.js (http-server)

npx http-server -p 8000

Option 3: Using VS Code Live Server

  • Install the "Live Server" extension
  • Right-click on index.html and select "Open with Live Server"

Then open http://localhost:8000 in your browser.

πŸ“ Adding New Components

  1. Create HTML Template (components/YourComponent.html):
<div class="your-component">
    <h2>{{title}}</h2>
    <p>{{description}}</p>
</div>
  1. Create Component Class (js/components/YourComponent.js):
import { Component } from '../core/Component.js';
import { ComponentLoader, TemplateEngine } from '../core/Component.js';

export class YourComponent extends Component {
    constructor(props) {
        super(props);
    }

    async render() {
        const template = await ComponentLoader.load('./components/YourComponent.html');
        return TemplateEngine.render(template, this.props);
    }
}
  1. Create CSS (css/your-component.css):
.your-component {
    /* Your styles */
}
  1. Import CSS in style.css:
@import url('./css/your-component.css');
  1. Use in App (js/app.js):
import { YourComponent } from './components/YourComponent.js';

// In render method:
const yourComponent = new YourComponent({ title: 'Title', description: 'Desc' });
await yourComponent.mount('#app', true);

πŸ”§ Template Syntax

Variables

<h1>{{name}}</h1>

Loops

{{#each items}}
    <div>{{title}}</div>
{{/each}}

Nested Loops

{{#each experiences}}
    <div>
        <h3>{{title}}</h3>
        <ul>
            {{#each responsibilities}}
            <li>{{this}}</li>
            {{/each}}
        </ul>
    </div>
{{/each}}

Conditionals

{{#if showContent}}
    <p>Content here</p>
{{/if}}

πŸ“¦ Component API

Component Class

class MyComponent extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    async render() {
        // Return HTML string
    }

    onMount() {
        // Called after component is mounted
    }

    setState(newState) {
        // Update state and re-render
    }
}

Mounting Components

// Replace content
await component.mount('#container');

// Append content
await component.mount('#container', true);

🎨 Styling Guidelines

  • Use CSS variables from base.css for colors and gradients
  • Keep component styles in their respective CSS files
  • Follow BEM naming convention for complex components
  • Use mobile-first responsive design

πŸ“š Data Structure

Update data/portfolio.js to modify content:

export const portfolioData = {
    personal: { ... },
    experience: [ ... ],
    projects: [ ... ],
    skills: { ... }
};

πŸ”„ Future Enhancements

  • Add routing for multi-page support
  • Implement state management system
  • Add component caching
  • Build system for production
  • Add TypeScript support
  • Implement lazy loading for components

πŸ“„ License

This project is open source and available for personal use.

About

my portfolio webpage

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages