Stub out login page

This commit is contained in:
Z. Charles Dziura 2025-06-11 20:46:25 -04:00
parent 9a5dbb4d18
commit deab6bb0b1
8 changed files with 75 additions and 15 deletions

View file

@ -1,4 +1,6 @@
<app-nav-rail></app-nav-rail>
@if ($showNavRail()) {
<app-nav-rail></app-nav-rail>
}
<main>
<router-outlet></router-outlet>
</main>

View file

@ -1,14 +1,19 @@
import { Routes } from '@angular/router';
import { Plan } from './routes/plan/plan';
import { Login } from './routes/login/login';
export const routes: Routes = [
{
path: '',
pathMatch: 'full',
redirectTo: '/plan'
},
{
path: 'plan',
component: Plan
},
{
path: 'login',
component: Login,
},
{
path: 'plan',
component: Plan,
},
{
path: '',
pathMatch: 'full',
redirectTo: '/login',
},
];

View file

@ -1,5 +1,10 @@
:host {
display: grid;
grid-template-columns: min-content auto;
min-height: 100vh;
display: grid;
grid-template-areas: 'nav' 'main';
grid-template-columns: min-content auto;
min-height: 100vh;
}
main {
grid-area: main;
}

View file

@ -1,11 +1,19 @@
import { Component } from '@angular/core';
import { Component, computed, signal } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { NavRail } from './components/nav-rail/nav-rail';
const ROUTES_THAT_HIDE_NAV_RAIL = /^\/login$/;
@Component({
selector: 'app-root',
imports: [RouterOutlet, NavRail],
styleUrl: './app.scss',
templateUrl: './app.html',
})
export class App {}
export class App {
private readonly $_pathname = signal(location.pathname);
readonly $showNavRail = computed(() => {
const pathname = this.$_pathname();
return pathname.length > 0 && !ROUTES_THAT_HIDE_NAV_RAIL.test(pathname);
});
}

View file

@ -0,0 +1 @@
<p>login works!</p>

View file

@ -0,0 +1,5 @@
:host {
display: grid;
height: 100%;
width: 100%;
}

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Login } from './login';
describe('Login', () => {
let component: Login;
let fixture: ComponentFixture<Login>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Login]
})
.compileComponents();
fixture = TestBed.createComponent(Login);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-login',
imports: [],
templateUrl: './login.html',
styleUrl: './login.scss'
})
export class Login {
}