diff --git a/index.html b/index.html index 7df5f36..e39bcea 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,9 @@ LMS Prototype + + + diff --git a/src/assets/after-sunset-minimal-4k-zm-3840x2400.jpg b/src/assets/after-sunset-minimal-4k-zm-3840x2400.jpg new file mode 100644 index 0000000..1888bc5 Binary files /dev/null and b/src/assets/after-sunset-minimal-4k-zm-3840x2400.jpg differ diff --git a/src/assets/images.jpg b/src/assets/images.jpg new file mode 100644 index 0000000..b3a1f7f Binary files /dev/null and b/src/assets/images.jpg differ diff --git a/src/pages/DashboardPage.ts b/src/pages/DashboardPage.ts index 2e99b44..9b6c4eb 100644 --- a/src/pages/DashboardPage.ts +++ b/src/pages/DashboardPage.ts @@ -7,7 +7,7 @@ import { createElement } from '../utils/utils'; class WelcomeWidget extends Widget { render(): HTMLElement { const widgetDiv = createElement('div'); - widgetDiv.classList.add('widget'); + widgetDiv.classList.add('widget', 'welcome-widget'); widgetDiv.innerHTML = `
Welcome to the Dashboard
@@ -21,7 +21,7 @@ class WelcomeWidget extends Widget { class QuickLinksWidget extends Widget { render(): HTMLElement { const widgetDiv = createElement('div'); - widgetDiv.classList.add('widget'); + widgetDiv.classList.add('widget', 'quick-links-widget'); widgetDiv.innerHTML = `
Quick Links
@@ -36,21 +36,20 @@ class QuickLinksWidget extends Widget { } } -class PlaceholderWidget extends Widget { // Corrected placeholder widget definition +class PlaceholderWidget extends Widget { render(): HTMLElement { const div = createElement('div'); - div.classList.add('widget'); + div.classList.add('widget', 'placeholder-widget'); div.textContent = 'Placeholder Widget'; return div; } } - export const renderDashboardPage = () => { const layout = new ThreeColumnLayout(); const welcomeWidget = new WelcomeWidget(); const quickLinksWidget = new QuickLinksWidget(); - const placeholderWidget = new PlaceholderWidget(); // Use the corrected PlaceholderWidget class + const placeholderWidget = new PlaceholderWidget(); layout.setColumn1Content(welcomeWidget.render()); layout.setColumn2Content(quickLinksWidget.render()); diff --git a/src/style.css b/src/style.css index 3bd4490..4491390 100644 --- a/src/style.css +++ b/src/style.css @@ -1,4 +1,4 @@ -/* Global styles */ +/* --- Global styles --- */ h1, h2, h3, @@ -12,41 +12,44 @@ body { margin: 0; padding: 0; overflow: hidden; - font-family: sans-serif; -} - -.scrolling-background { - position: fixed; - top: 0; - left: 0; - width: 100%; /* Ensure it covers full width */ - height: 100vh; /* Full viewport height */ - background-image: url('./assets/bg1.jpg'); - background-repeat: repeat-x; - background-size: auto 100%; /* Maintain width and fill height */ - animation: scroll-bg 30s linear infinite; - z-index: -2; + font-family: 'Roboto', sans-serif; } @keyframes scroll-bg { - from { - background-position: 0 0; - } - to { - background-position: -100% 0; - } + from { + background-position: 0 0; + } + + to { + background-position: -100% 0; + } } .color-overlay { - position: fixed; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - background-color: rgba(33, 37, 41, 0.925); - z-index: -1; + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-color: rgba(33, 37, 41, 0.925); + z-index: -1; } +.scrolling-background { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100vh; + background-image: url('./assets/after-sunset-minimal-4k-zm-3840x2400.jpg'); + background-repeat: repeat-x; + background-size: auto 100%; + animation: scroll-bg 30s linear infinite; + z-index: -2; +} + +/* --- Widget Styling --- */ + .widget { border: 1px solid rgb(0, 0, 0, 0.20); background-color: rgb(31, 35, 39, 0.9); @@ -56,20 +59,18 @@ body { } .widget-header { + font-size: 18px; margin-bottom: 10px; font-weight: bold; } -.widget-body { - /* Widget body styles */ -} .icon-widget { padding: 10px; text-align: center; } -/* Layout Specific Styles */ +/* --- Layout Specific Styles --- */ .centered-layout { display: flex; justify-content: center; @@ -98,7 +99,7 @@ body { } -/* Modal Styles */ +/* --- Modal Styles --- */ .modal-overlay { position: fixed; top: 0; @@ -125,7 +126,7 @@ body { /* Maximum width */ } -/* Responsive adjustments (example) */ +/* --- Responsive adjustments (example) --- */ @media (max-width: 768px) { .three-column-layout { grid-template-columns: 1fr; @@ -141,4 +142,40 @@ body { grid-template-columns: 1fr; /* Stack even if collapsed */ } +} + +/* --- Custom styles --- */ + +.login-container { + background-image: url('./assets/images.jpg'); + /* Replace with your logo path */ + background-repeat: no-repeat; + background-position: center top; + /* Center the logo at the top */ + background-size: 80x 80px; + /* Adjust the size of the logo */ + padding-top: 60px; + /* Add padding to create space for the logo */ + text-align: center; + /* Center text and form elements */ +} + +.logo { + display: block; + margin: 0 auto 20px; + /* Center the logo and add space below */ + max-width: 100px; + /* Adjust the size as needed */ + width: 80px; + /* Set the width of the logo */ + height: 80px; + /* Set the height of the logo */ + border-radius: 50%; + /* Make the logo circular */ + background-image: url('./assets/images.jpg'); + /* Replace with your logo path */ + background-size: cover; + /* Cover the entire area */ + margin: 0 auto 20px; + /* Center the logo and add space below */ } \ No newline at end of file diff --git a/src/widgets/LoginWidget.ts b/src/widgets/LoginWidget.ts index 1961c05..54c792c 100644 --- a/src/widgets/LoginWidget.ts +++ b/src/widgets/LoginWidget.ts @@ -11,52 +11,40 @@ export class LoginWidget extends Widget { render(): HTMLElement { this.container.innerHTML = ''; + // Create a logo container + const logoContainer = createElement('div') as HTMLElement; + logoContainer.classList.add('logo'); // Add class for circular logo + this.container.appendChild(logoContainer); + + // Create header const header = createElement('h2'); header.classList.add('widget-header'); header.textContent = 'Login'; + this.container.appendChild(header); + // Create form const form = createElement('form'); - const userIdInputGroup = createElement('div'); - userIdInputGroup.classList.add('mb-3'); - const userIdLabel = createElement('label') as HTMLLabelElement; // Cast first - userIdLabel.classList.add('form-label'); - userIdLabel.htmlFor = 'userId'; // Set htmlFor as property - userIdLabel.textContent = 'Student ID'; - const userIdInput = createElement('input') as HTMLInputElement; - userIdInput.type = 'text'; - userIdInput.classList.add('form-control'); - userIdInput.id = 'userId'; - userIdInput.placeholder = '123456'; - userIdInputGroup.appendChild(userIdLabel); - userIdInputGroup.appendChild(userIdInput); - const passwordInputGroup = createElement('div'); - passwordInputGroup.classList.add('mb-3'); - const passwordLabel = createElement('label') as HTMLLabelElement; // Cast first - passwordLabel.classList.add('form-label'); - passwordLabel.htmlFor = 'password'; // Set htmlFor as property - passwordLabel.textContent = 'Password'; - const passwordInput = createElement('input') as HTMLInputElement; - passwordInput.type = 'password'; - passwordInput.classList.add('form-control'); - passwordInput.id = 'password'; - passwordInput.placeholder = 'Password'; - passwordInputGroup.appendChild(passwordLabel); - passwordInputGroup.appendChild(passwordInput); + // User ID input group + const userIdInputGroup = this.createInputGroup('userId', 'Student ID', 'text', 'Student ID'); + form.appendChild(userIdInputGroup); + // Password input group + const passwordInputGroup = this.createInputGroup('password', 'Password', 'password', 'Password'); + form.appendChild(passwordInputGroup); + + // Login button const loginButton = createElement('button'); loginButton.type = 'submit'; loginButton.classList.add('btn', 'btn-primary'); loginButton.textContent = 'Login'; - - form.appendChild(userIdInputGroup); - form.appendChild(passwordInputGroup); form.appendChild(loginButton); + // Form submission handler form.addEventListener('submit', async (event) => { event.preventDefault(); - const userId = userIdInput.value; - const password = passwordInput.value; + const userId = (userIdInputGroup.querySelector('input') as HTMLInputElement).value; + const password = (passwordInputGroup.querySelector('input') as HTMLInputElement).value; try { const response: ApiResponse = await globalAPI.login({ userId, password }); @@ -71,8 +59,28 @@ export class LoginWidget extends Widget { } }); - this.container.appendChild(header); this.container.appendChild(form); return this.container; } + + private createInputGroup(id: string, labelText: string, inputType: string, placeholder: string): HTMLElement { + const inputGroup = createElement('div'); + inputGroup.classList.add('mb-3'); + + const label = createElement('label') as HTMLLabelElement; + label.classList.add('form-label'); + label.htmlFor = id; + label.textContent = labelText; + + const input = createElement('input') as HTMLInputElement; + input.type = inputType; + input.classList.add('form-control'); + input.id = id; + input.placeholder = placeholder; + + inputGroup.appendChild(label); + inputGroup.appendChild(input); + + return inputGroup; + } } \ No newline at end of file diff --git a/src/widgets/RegisterWidget.ts b/src/widgets/RegisterWidget.ts index cfb401e..8441c5c 100644 --- a/src/widgets/RegisterWidget.ts +++ b/src/widgets/RegisterWidget.ts @@ -7,11 +7,11 @@ export class RegisterWidget extends Widget { constructor(message?: string) { super(); - this.message = message || "For registration, please contact your department head for further instructions."; + this.message = message || ""; } render(): HTMLElement { - this.container.innerHTML = ''; // Clear previous content + this.container.innerHTML = ''; const header = createElement('h2'); header.classList.add('widget-header'); @@ -24,7 +24,7 @@ export class RegisterWidget extends Widget { const button = createElement('button'); button.classList.add('btn', 'btn-secondary'); button.textContent = 'Register'; - button.disabled = true; + button.addEventListener('click', () => { navigateTo('/register'); }); @@ -34,4 +34,4 @@ export class RegisterWidget extends Widget { this.container.appendChild(button); return this.container; } -} \ No newline at end of file +}