Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

footer are created and buttom for dark and light mode alternate #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
50 changes: 50 additions & 0 deletions src/app/app.component.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@

.app-container {
display: flex;
flex-direction: column;
min-height: 100vh;
}
header {
margin-top: 15px;
display: flex;
justify-content: center;
}

.content {

flex-grow: 1
}

app-footer {
background-color: #333;
color: #fff;
padding: 2px;
margin: 5px;
text-align: center;
height: 10%;
}

.light-mode {
background-color: #fff;
color: #000;
}

/* Modo escuro (estilos existentes) */
.dark-mode {
background-color: #111111;
color: white;
}

/* app.component.css */
button.toggle-mode {
position: absolute;
top: 10px;
right: 10px;
background-color: var(--bg-color-dark);
color: var(--text-color-dark);
border: none;
padding: 10px 20px;
cursor: pointer;
}

/* Estilos para o modo claro */
.light-mode button.toggle-mode {
background-color: var(--bg-color-light);
color: var(--text-color-light);
}

21 changes: 17 additions & 4 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
<header>
<app-menu-bar></app-menu-bar>
</header>
<router-outlet></router-outlet>
<div [ngStyle]="themeService.isDarkMode ? darkModeStyles : lightModeStyles">
<button class="toggle-mode" (click)="toggleTheme()">
{{ themeService.isDarkMode ? 'Light Mode' : 'Dark Mode' }}
</button>
<div class="app-container">
<header>
<app-menu-bar></app-menu-bar>
</header>

<div class="content">
<router-outlet></router-outlet>
</div>

<app-footer></app-footer>
</div>
</div>

18 changes: 17 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { Component, ElementRef, Renderer2 } from '@angular/core';
import { ThemeService } from './services/theme.service';

@Component({
selector: 'app-root',
Expand All @@ -7,4 +8,19 @@ import { Component } from '@angular/core';
})
export class AppComponent {
title = 'angular-blog';
darkModeStyles = {
'background-color': 'black',
'color': 'white'
};

lightModeStyles = {
'background-color': 'white',
'color': 'black '
};

constructor(public themeService: ThemeService) {}

toggleTheme() {
this.themeService.toggleMode();
}
}
5 changes: 4 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { BigCardComponent } from './components/big-card/big-card.component';
import { SmallCardComponent } from './components/small-card/small-card.component';
import { HomeComponent } from './pages/home/home.component';
import { ContentComponent } from './pages/content/content.component';
import { FooterComponent } from './components/footer/footer.component';



@NgModule({
Expand All @@ -19,7 +21,8 @@ import { ContentComponent } from './pages/content/content.component';
BigCardComponent,
SmallCardComponent,
HomeComponent,
ContentComponent
ContentComponent,
FooterComponent,
],
imports: [
BrowserModule,
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions src/app/components/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="footer">
<p>&copy; 2023 DIO</p>
</div>
23 changes: 23 additions & 0 deletions src/app/components/footer/footer.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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({
declarations: [ FooterComponent ]
})
.compileComponents();

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

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

@Component({
selector: 'app-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.css']
})
export class FooterComponent implements OnInit {

ngOnInit(): void {
}

}
2 changes: 0 additions & 2 deletions src/app/components/menu-bar/menu-bar.component.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


.container__menu-bar > ul{
display: flex;
flex-direction: row;
Expand Down
1 change: 1 addition & 0 deletions src/app/components/menu-bar/menu-bar.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<div class="container__menu-bar">

<ul>
<li><a href="https://linkedin.com/in/felipe-aguiar-exe">Linkedin</a></li>
<li><span>•</span></li>
Expand Down
4 changes: 1 addition & 3 deletions src/app/components/menu-title/menu-title.component.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.container__menu-title{
color: white;
}


.container__menu-title > h1{
margin-top: 15px;
Expand Down
11 changes: 11 additions & 0 deletions src/app/services/theme.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Injectable } from '@angular/core';

@Injectable({
providedIn: 'root'
})
export class ThemeService {
isDarkMode = false;
toggleMode() {
this.isDarkMode = !this.isDarkMode;
}
}
10 changes: 8 additions & 2 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
margin:0;
padding:0;
box-sizing: border-box;
background-color: #111111;
color:white;
font-family: 'Segoe UI';
}

a{
text-decoration: none;
}
a {
color: #007bff; /* Defina a cor desejada para os links */
text-decoration: none; /* Remova ou ajuste a decoração do link, se necessário */
}

a:hover {
text-decoration: underline; /* Adicione um estilo de sublinhado ao passar o mouse sobre os links, se desejado */
}