mirror of
https://github.com/simon987/dsynth.net.git
synced 2025-04-19 17:46:42 +00:00
nav bar & basic layout
This commit is contained in:
parent
e0d44c630d
commit
9bc41d7dc0
@ -1,8 +1,12 @@
|
|||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from "@angular/core";
|
||||||
import {RouterModule, Routes} from '@angular/router';
|
import {RouterModule, Routes} from "@angular/router";
|
||||||
|
import {ContactComponent} from "./contact/contact.component";
|
||||||
|
|
||||||
|
|
||||||
const routes: Routes = [];
|
const routes: Routes = [
|
||||||
|
{path: "", component: ContactComponent},
|
||||||
|
{path: "contact", component: ContactComponent},
|
||||||
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes)],
|
imports: [RouterModule.forRoot(routes)],
|
||||||
|
13
dsynth/src/app/app.component.css
Normal file
13
dsynth/src/app/app.component.css
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
.large-nav {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.large-nav {
|
||||||
|
display: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small-nav {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,22 @@
|
|||||||
<mat-toolbar color="primary">
|
<mat-toolbar color="primary">
|
||||||
|
|
||||||
|
<div class="large-nav">
|
||||||
|
<button mat-button [class.mat-accent]="router.url === '/'" class="nav-title"
|
||||||
|
[routerLink]="''">{{"nav.title" | translate}}</button>
|
||||||
|
</div>
|
||||||
|
<div class="small-nav">
|
||||||
|
<button mat-button [matMenuTriggerFor]="smallNav">
|
||||||
|
<mat-icon>more_vert</mat-icon>
|
||||||
|
</button>
|
||||||
|
<mat-menu #smallNav>
|
||||||
|
<button mat-menu-item [class.mat-accent]="router.url === '/'" class="nav-title"
|
||||||
|
[routerLink]="''">{{"nav.title" | translate}}</button>
|
||||||
|
</mat-menu>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span class="spacer"></span>
|
||||||
|
|
||||||
|
<!-- Lang select-->
|
||||||
<button mat-button [matMenuTriggerFor]="langMenu">
|
<button mat-button [matMenuTriggerFor]="langMenu">
|
||||||
{{"nav.lang_select" | translate}}
|
{{"nav.lang_select" | translate}}
|
||||||
<mat-icon>arrow_drop_down</mat-icon>
|
<mat-icon>arrow_drop_down</mat-icon>
|
||||||
@ -11,6 +28,6 @@
|
|||||||
</mat-menu>
|
</mat-menu>
|
||||||
</mat-toolbar>
|
</mat-toolbar>
|
||||||
|
|
||||||
<h1> {{ "nav.test" | translate }}</h1>
|
<div class="container">
|
||||||
|
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
|
</div>
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import {Component} from '@angular/core';
|
import {Component} from "@angular/core";
|
||||||
import {TranslateService} from "@ngx-translate/core";
|
import {TranslateService} from "@ngx-translate/core";
|
||||||
|
import {Router} from "@angular/router";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: "app-root",
|
||||||
templateUrl: './app.component.html',
|
templateUrl: "./app.component.html",
|
||||||
styleUrls: []
|
styleUrls: ["./app.component.css"]
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
|
||||||
constructor(private translate: TranslateService) {
|
constructor(private translate: TranslateService, public router: Router) {
|
||||||
|
|
||||||
translate.addLangs([
|
translate.addLangs([
|
||||||
'en',
|
'en',
|
||||||
@ -20,8 +21,8 @@ export class AppComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
langList: any[] = [
|
langList: any[] = [
|
||||||
{lang: 'fr', display: 'Français'},
|
|
||||||
{lang: 'en', display: 'English'},
|
{lang: 'en', display: 'English'},
|
||||||
|
{lang: 'fr', display: 'Français'},
|
||||||
{lang: 'ru', display: 'Русский'},
|
{lang: 'ru', display: 'Русский'},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ import {TranslateHttpLoader} from '@ngx-translate/http-loader';
|
|||||||
import {MatButtonModule} from "@angular/material/button";
|
import {MatButtonModule} from "@angular/material/button";
|
||||||
import {TranslateLoader, TranslateModule} from "@ngx-translate/core";
|
import {TranslateLoader, TranslateModule} from "@ngx-translate/core";
|
||||||
import {HttpClient, HttpClientModule} from "@angular/common/http";
|
import {HttpClient, HttpClientModule} from "@angular/common/http";
|
||||||
|
import { ContactComponent } from './contact/contact.component';
|
||||||
|
import {MatCardModule} from "@angular/material/card";
|
||||||
|
|
||||||
export function createTranslateLoader(http: HttpClient) {
|
export function createTranslateLoader(http: HttpClient) {
|
||||||
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
||||||
@ -18,7 +20,8 @@ export function createTranslateLoader(http: HttpClient) {
|
|||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent
|
AppComponent,
|
||||||
|
ContactComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@ -37,6 +40,7 @@ export function createTranslateLoader(http: HttpClient) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
MatCardModule,
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
|
8
dsynth/src/app/contact/contact.component.css
Normal file
8
dsynth/src/app/contact/contact.component.css
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
.example-card {
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.example-header-image {
|
||||||
|
background-image: url('https://material.angular.io/assets/img/examples/shiba1.jpg');
|
||||||
|
background-size: cover;
|
||||||
|
}
|
21
dsynth/src/app/contact/contact.component.html
Normal file
21
dsynth/src/app/contact/contact.component.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<mat-card class="example-card">
|
||||||
|
<mat-card-header>
|
||||||
|
<div mat-card-avatar class="example-header-image"></div>
|
||||||
|
<mat-card-title> {{ "nav.test" | translate }}</mat-card-title>
|
||||||
|
<mat-card-subtitle>Dog Breed</mat-card-subtitle>
|
||||||
|
</mat-card-header>
|
||||||
|
<img mat-card-image src="https://material.angular.io/assets/img/examples/shiba2.jpg" alt="Photo of a Shiba Inu">
|
||||||
|
<mat-card-content>
|
||||||
|
<p>
|
||||||
|
The Shiba Inu is the smallest of the six original and distinct spitz breeds of dog from Japan.
|
||||||
|
A small, agile dog that copes very well with mountainous terrain, the Shiba Inu was originally
|
||||||
|
bred for hunting.
|
||||||
|
</p>
|
||||||
|
</mat-card-content>
|
||||||
|
<mat-card-actions>
|
||||||
|
<button mat-button>LIKE</button>
|
||||||
|
<button mat-button>SHARE</button>
|
||||||
|
</mat-card-actions>
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
|
16
dsynth/src/app/contact/contact.component.ts
Normal file
16
dsynth/src/app/contact/contact.component.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: "app-contact",
|
||||||
|
templateUrl: "./contact.component.html",
|
||||||
|
styleUrls: ["./contact.component.css"]
|
||||||
|
})
|
||||||
|
export class ContactComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"nav": {
|
"nav": {
|
||||||
|
"title": "dsynth.net",
|
||||||
|
"lang_select": "Language",
|
||||||
"test": "Hello"
|
"test": "Hello"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,55 @@
|
|||||||
/* You can add global styles to this file, and also import other style files */
|
|
||||||
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: Roboto, "Helvetica Neue", sans-serif;
|
font-family: Roboto, "Helvetica Neue", sans-serif;
|
||||||
|
background: #303030;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
padding-right: 15px;
|
||||||
|
padding-left: 15px;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-top: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 576px) {
|
||||||
|
.container {
|
||||||
|
max-width: 540px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.container {
|
||||||
|
max-width: 720px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
.container {
|
||||||
|
max-width: 960px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
.container {
|
||||||
|
max-width: 1140px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1600px) {
|
||||||
|
.container {
|
||||||
|
max-width: 1440px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 2200px) {
|
||||||
|
.container {
|
||||||
|
max-width: 2000px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.spacer {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user