Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"cli": {
"schematicCollections": [
"angular-eslint"
]
],
"analytics": false
}
}
21 changes: 19 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"private": true,
"dependencies": {
"@angular/cdk": "^19.2.1",
"@angular/common": "^19.2.0",
"@angular/compiler": "^19.2.0",
"@angular/core": "^19.2.0",
Expand Down
376 changes: 19 additions & 357 deletions src/app/app.component.html

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.layout-desktop {
display: flex;
height: 100vh;

.content {
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
width: 100%;
border: 6px solid #24384a;
border-radius: 12px;
box-sizing: content-box;

.content-wrapper {
position: relative;
display: flex;
flex-direction: column;
flex: 1;
}
}
}

.layout-tablet {
display: flex;
height: 100vh;

.content {
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
width: 100%;

.content-wrapper {
position: relative;
display: flex;
flex-direction: column;
flex: 1;
}
}
}
21 changes: 18 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { SidenavComponent } from '@osf/sidenav/sidenav.component';
import { RouterOutlet } from '@angular/router';
import { HeaderComponent } from '@osf/header/header.component';
import { MainContentComponent } from '@osf/main-content/main-content.component';
import { FooterComponent } from '@osf/footer/footer.component';
import { TopnavComponent } from '@osf/topnav/topnav.component';
import { IS_PORTRAIT } from '@shared/utils/breakpoints.tokens';
import { toSignal } from '@angular/core/rxjs-interop';

@Component({
selector: 'osf-root',
imports: [RouterOutlet],
imports: [
SidenavComponent,
RouterOutlet,
HeaderComponent,
MainContentComponent,
FooterComponent,
TopnavComponent,
],
templateUrl: './app.component.html',
styleUrl: './app.component.scss',
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent {
title = 'osf';
private isPortrait$ = inject(IS_PORTRAIT);
isPortrait = toSignal(this.isPortrait$);
}
1 change: 1 addition & 0 deletions src/app/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>footer works!</p>
4 changes: 4 additions & 0 deletions src/app/footer/footer.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:host {
height: 50px;
background: aqua;
}
22 changes: 22 additions & 0 deletions src/app/footer/footer.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { FooterComponent } from './footer.component';

describe('FooterComponent', () => {
let component: FooterComponent;
let fixture: ComponentFixture<FooterComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [FooterComponent],
}).compileComponents();

fixture = TestBed.createComponent(FooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions src/app/footer/footer.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
standalone: true,
selector: 'osf-footer',
imports: [],
templateUrl: './footer.component.html',
styleUrl: './footer.component.scss',
})
export class FooterComponent {}
2 changes: 2 additions & 0 deletions src/app/header/header.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<button class="button">Sign In</button>
<button class="button">Donate</button>
7 changes: 7 additions & 0 deletions src/app/header/header.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:host {
position: absolute;
height: 50px;
top: 0;
right: 0;
background: transparent;
}
22 changes: 22 additions & 0 deletions src/app/header/header.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { HeaderComponent } from './header.component';

describe('HeaderComponent', () => {
let component: HeaderComponent;
let fixture: ComponentFixture<HeaderComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HeaderComponent],
}).compileComponents();

fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions src/app/header/header.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
standalone: true,
selector: 'osf-header',
imports: [],
templateUrl: './header.component.html',
styleUrl: './header.component.scss',
})
export class HeaderComponent {}
3 changes: 3 additions & 0 deletions src/app/main-content/main-content.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<main class="content-body">
<span>main-content works!</span>
</main>
12 changes: 12 additions & 0 deletions src/app/main-content/main-content.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
:host {
min-height: calc(100% - 100px);
padding-top: 50px;
background: antiquewhite;

.content-body {
flex: 1;
}
.main-container {
height: 100px;
}
}
22 changes: 22 additions & 0 deletions src/app/main-content/main-content.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { MainContentComponent } from './main-content.component';

describe('MainContentComponent', () => {
let component: MainContentComponent;
let fixture: ComponentFixture<MainContentComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [MainContentComponent],
}).compileComponents();

fixture = TestBed.createComponent(MainContentComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions src/app/main-content/main-content.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
standalone: true,
selector: 'osf-main-content',
imports: [],
templateUrl: './main-content.component.html',
styleUrl: './main-content.component.scss',
})
export class MainContentComponent {}
24 changes: 24 additions & 0 deletions src/app/shared/utils/breakpoints.tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { inject, InjectionToken } from '@angular/core';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Observable, map } from 'rxjs';

function createBreakpointToken(
query: string,
): InjectionToken<Observable<boolean>> {
return new InjectionToken<Observable<boolean>>(`Breakpoint ${query}`, {
providedIn: 'root',
factory: () => {
const breakpointObserver = inject(BreakpointObserver);
return breakpointObserver
.observe([query])
.pipe(map((result) => result.matches));
},
});
}

export const IS_XSMALL = createBreakpointToken(Breakpoints.XSmall);
export const IS_SMALL = createBreakpointToken(Breakpoints.Small);
export const IS_MEDIUM = createBreakpointToken(Breakpoints.Medium);
export const IS_LARGE = createBreakpointToken(Breakpoints.Large);
export const IS_XLARGE = createBreakpointToken(Breakpoints.XLarge);
export const IS_PORTRAIT = createBreakpointToken('(orientation: portrait)');
6 changes: 6 additions & 0 deletions src/app/sidenav/sidenav.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h2>OSF</h2>
<ul>
<li>Home</li>
<li>Search OSF</li>
<li>Support</li>
</ul>
7 changes: 7 additions & 0 deletions src/app/sidenav/sidenav.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:host {
display: flex;
flex-direction: column;
width: 250px;
height: 100%;
color: white;
}
22 changes: 22 additions & 0 deletions src/app/sidenav/sidenav.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SidenavComponent } from './sidenav.component';

describe('SidenavDComponent', () => {
let component: SidenavComponent;
let fixture: ComponentFixture<SidenavComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SidenavComponent],
}).compileComponents();

fixture = TestBed.createComponent(SidenavComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions src/app/sidenav/sidenav.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
standalone: true,
selector: 'osf-sidenav',
imports: [],
templateUrl: './sidenav.component.html',
styleUrl: './sidenav.component.scss',
})
export class SidenavComponent {}
1 change: 1 addition & 0 deletions src/app/topnav/topnav.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>OSF</p>
5 changes: 5 additions & 0 deletions src/app/topnav/topnav.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:host {
background: #24384a;
height: 96px;
color: white;
}
22 changes: 22 additions & 0 deletions src/app/topnav/topnav.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TopnavComponent } from './topnav.component';

describe('TopnavComponent', () => {
let component: TopnavComponent;
let fixture: ComponentFixture<TopnavComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TopnavComponent],
}).compileComponents();

fixture = TestBed.createComponent(TopnavComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions src/app/topnav/topnav.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
standalone: true,
selector: 'osf-topnav',
imports: [],
templateUrl: './topnav.component.html',
styleUrl: './topnav.component.scss',
})
export class TopnavComponent {}
Loading