Skip to content

Commit

Permalink
demo/2.0: Refactor naming
Browse files Browse the repository at this point in the history
  • Loading branch information
farengeyt451 committed Jul 18, 2023
1 parent 23b97c8 commit 52340fa
Show file tree
Hide file tree
Showing 44 changed files with 152 additions and 170 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@taiga-ui/styles": "^3.7.1",
"@tinkoff/ng-dompurify": "4.0.0",
"dompurify": "2.4.0",
"ngx-tippy-wrapper": "file:dist/ngx-tippy-wrapper/ngx-tippy-wrapper-6.2.0.tgz",
"rxjs": "~7.5.7",
"tslib": "^2.4.0",
"zone.js": "~0.11.8"
Expand Down
8 changes: 4 additions & 4 deletions projects/ngx-tippy-demo/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
<tui-theme-night *ngIf="scheme === Schemes.Dark"></tui-theme-night>

<header class="t-demo__header">
<t-demo-header></t-demo-header>
<header></header>
</header>

<main class="t-demo__main">

<nav class="t-demo__nav">
<t-demo-nav></t-demo-nav>
<nav></nav>
</nav>

<div class="t-demo__content">
<t-demo-content></t-demo-content>
<content></content>
</div>
</main>

<footer class="t-demo__footer">
<t-demo-footer></t-demo-footer>
<footer></footer>
</footer>

</tui-root>
26 changes: 12 additions & 14 deletions projects/ngx-tippy-demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { APP_INITIALIZER, NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ContentComponent } from '@components/content';
import { FooterComponent } from '@components/footer';
import { GettingStartedComponent } from '@components/getting-started';
import { TDemoContentComponent } from '@components/t-demo-content';
import { TDemoFooterComponent } from '@components/t-demo-footer';
import { TDemoHeaderComponent } from '@components/t-demo-header';
import { TDemoNavComponent } from '@components/t-demo-nav';
import { TDemoSchemeSwitcherComponent } from '@components/t-demo-scheme-switcher';
import { TDemoSocialComponent } from '@components/t-demo-social';
import { HeaderComponent } from '@components/header';
import { NavComponent } from '@components/nav';
import { SchemeSwitcherComponent } from '@components/scheme-switcher';
import { SocialComponent } from '@components/social';
import { TuiLetModule } from '@taiga-ui/cdk';
import {
TUI_SANITIZER,
Expand All @@ -22,7 +22,6 @@ import {
} from '@taiga-ui/core';
import { TuiInputModule } from '@taiga-ui/kit';
import { NgDompurifySanitizer } from '@tinkoff/ng-dompurify';
import { HighlightModule } from 'ngx-highlightjs';
import { NgxTippyModule } from 'ngx-tippy-wrapper';
import { SchemeService } from '../services/scheme-service';
import { AppRoutingModule } from './app-routing.module';
Expand All @@ -35,12 +34,12 @@ function initialize(SchemeService: SchemeService) {
@NgModule({
declarations: [
AppComponent,
TDemoHeaderComponent,
TDemoNavComponent,
TDemoFooterComponent,
TDemoContentComponent,
TDemoSchemeSwitcherComponent,
TDemoSocialComponent,
HeaderComponent,
NavComponent,
FooterComponent,
ContentComponent,
SchemeSwitcherComponent,
SocialComponent,
GettingStartedComponent,
],
imports: [
Expand All @@ -58,7 +57,6 @@ function initialize(SchemeService: SchemeService) {
TuiModeModule,
TuiLetModule,
TuiThemeNightModule,
HighlightModule,
],
providers: [
{ provide: TUI_SANITIZER, useClass: NgDompurifySanitizer },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TDemoNavComponent } from '../t-demo-nav.component';
import { ContentComponent } from '../content.component';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TDemoNavComponent],
declarations: [ContentComponent],
}).compileComponents();

fixture = TestBed.createComponent(TDemoNavComponent);
fixture = TestBed.createComponent(ContentComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';

@Component({
selector: 't-demo-nav',
templateUrl: './t-demo-nav.component.html',
styleUrls: ['./t-demo-nav.component.scss'],
selector: 'content',
templateUrl: './content.component.html',
styleUrls: ['./content.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TDemoNavComponent implements OnInit {
export class ContentComponent implements OnInit {
constructor() {}

ngOnInit(): void {}
Expand Down
1 change: 1 addition & 0 deletions projects/ngx-tippy-demo/src/components/content/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ContentComponent } from './content.component';
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TDemoHeaderComponent } from '../t-demo-header.component';
import { FooterComponent } from '../footer.component';

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

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

fixture = TestBed.createComponent(TDemoHeaderComponent);
fixture = TestBed.createComponent(FooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';

@Component({
selector: 't-demo-footer',
templateUrl: './t-demo-footer.component.html',
styleUrls: ['./t-demo-footer.component.scss'],
selector: 'footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TDemoFooterComponent implements OnInit {
export class FooterComponent implements OnInit {
constructor() {}

ngOnInit(): void {}
Expand Down
1 change: 1 addition & 0 deletions projects/ngx-tippy-demo/src/components/footer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { FooterComponent } from './footer.component';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>works</p>
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { HighlightLoader } from 'ngx-highlightjs';

const themeGithub: string = 'node_modules/highlight.js/styles/github.css';
const themeAndroidStudio: string = 'node_modules/highlight.js/styles/androidstudio.css';

@Component({
selector: 'getting-started',
Expand All @@ -11,19 +7,7 @@ const themeAndroidStudio: string = 'node_modules/highlight.js/styles/androidstud
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class GettingStartedComponent implements OnInit {
code = `function myFunction() {
document.getElementById("demo1").innerHTML = "Test 1!";
document.getElementById("demo2").innerHTML = "Test 2!";
}`;

currentTheme: string = themeGithub;

constructor(private hljsLoader: HighlightLoader) {}
constructor() {}

ngOnInit(): void {}

changeTheme() {
this.currentTheme = this.currentTheme === themeGithub ? themeAndroidStudio : themeGithub;
this.hljsLoader.setTheme(this.currentTheme);
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TDemoFooterComponent } from '../t-demo-footer.component';
import { HeaderComponent } from '../header.component';

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

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

fixture = TestBed.createComponent(TDemoFooterComponent);
fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<div class="header">
<div
class="header__hero"
tabindex="0"
>
<div class="header__logo">
<img
class="header__img header__img--ng"
src="assets/icons/angular.svg"
alt="angular logo"
>
<img
class="header__img header__img--tippy"
src="assets/icons/tippy.svg"
alt="tippy.js logo"
>
</div>

<h2 class="header__title">ngx-tippy-wrapper</h2>
</div>

<div class="header__actions">
<div class="header__social">
<social></social>
</div>
<div class="header__scheme-switcher">
<scheme-switcher></scheme-switcher>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@

$animation-time: 3s;

.t-demo-header {
.header {
display: flex;
align-items: center;
justify-content: space-between;
}

.t-demo-header__hero {
.header__hero {
display: flex;
align-items: center;
}

.t-demo-header__title {
.header__title {
font-family: var(--font-noto);
font-size: 1.2rem;
}

.t-demo-header__actions {
.header__actions {
display: flex;
align-items: center;
}

.t-demo-header__scheme-switcher {
.header__scheme-switcher {
margin-left: 2rem;
}

.t-demo-header__img {
.header__img {
width: 100%;
max-width: 60px;
height: auto;
max-height: $header-height;
animation: animation-bounce $animation-time ease infinite alternate;
}

.t-demo-header__img--tippy {
.header__img--tippy {
position: relative;
left: -25px;
z-index: -1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';

@Component({
selector: 't-demo-header',
templateUrl: './t-demo-header.component.html',
styleUrls: ['./t-demo-header.component.scss'],
selector: 'header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TDemoHeaderComponent implements OnInit {
export class HeaderComponent implements OnInit {
constructor() {}

public ngOnInit(): void {}
Expand Down
1 change: 1 addition & 0 deletions projects/ngx-tippy-demo/src/components/header/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { HeaderComponent } from './header.component';
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NavComponent } from '../nav.component';

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

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

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
1 change: 1 addition & 0 deletions projects/ngx-tippy-demo/src/components/nav/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { NavComponent } from './nav.component';
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';

@Component({
selector: 't-demo-content',
templateUrl: './t-demo-content.component.html',
styleUrls: ['./t-demo-content.component.scss'],
selector: 'nav',
templateUrl: './nav.component.html',
styleUrls: ['./nav.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TDemoContentComponent implements OnInit {
export class NavComponent implements OnInit {
constructor() {}

ngOnInit(): void {}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SchemeSwitcherComponent } from '../scheme-switcher.component';

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

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

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { SchemeSwitcherComponent } from './scheme-switcher.component';
Loading

0 comments on commit 52340fa

Please sign in to comment.