Add Stylelint Config & Clear Button in SearchBox

Add Stylelint Config & Clear Button in SearchBox
This commit is contained in:
Sebastian
2020-09-28 15:27:48 +02:00
parent 2a9edff9c3
commit 4da22194af
22 changed files with 1589 additions and 288 deletions

View File

@@ -8,5 +8,8 @@
}, },
"[typescript]": { "[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
} },
"css.validate": false,
"less.validate": false,
"scss.validate": false
} }

View File

View File

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

View File

@@ -1,16 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'crm-crm',
template: `
<p>
crm works!
</p>
`,
styles: [],
})
export class CrmComponent implements OnInit {
constructor() {}
ngOnInit() {}
}

View File

@@ -1,12 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { CrmService } from './crm.service';
describe('CrmService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: CrmService = TestBed.inject(CrmService);
expect(service).toBeTruthy();
});
});

View File

@@ -1,8 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class CrmService {
constructor() {}
}

View File

@@ -8,17 +8,41 @@
Ihre E-Mail-Adresse? Ihre E-Mail-Adresse?
</p> </p>
<ui-searchbox> <ui-searchbox>
<input type="text" uiSearchboxInput placeholder="Name, E-Mail, Kundennummer, ..." /> <input
#input
(input)="onChange(input.value)"
type="text"
uiSearchboxInput
placeholder="Name, E-Mail, Kundennummer, ..."
/>
<ui-searchbox-warning> <ui-searchbox-warning>
Keine Sucherbnisse Keine Suchergebnisse
</ui-searchbox-warning> </ui-searchbox-warning>
<button type="submit" uiSearchboxSearchButton (click)="autocomplete.toggle()"> <button
*ngIf="input?.value?.length"
type="reset"
uiSearchboxClearButton
(click)="input.value = ''"
>
<ui-icon icon="close" size="22px"></ui-icon>
</button>
<button
type="submit"
uiSearchboxSearchButton
(click)="autocomplete.toggle()"
>
<ui-icon icon="search" size="24px"></ui-icon> <ui-icon icon="search" size="24px"></ui-icon>
</button> </button>
<ui-searchbox-autocomplete #autocomplete> <ui-searchbox-autocomplete #autocomplete>
<button uiSearchboxAutocompleteOption value="Hans Wernder">Hans Wernder</button> <button uiSearchboxAutocompleteOption value="Hans Wernder">
<button uiSearchboxAutocompleteOption value="Hans Müller">Hans Müller</button> Hans Wernder
<button uiSearchboxAutocompleteOption value="Hans Bauer">Hans Bauer</button> </button>
<button uiSearchboxAutocompleteOption value="Hans Müller">
Hans Müller
</button>
<button uiSearchboxAutocompleteOption value="Hans Bauer">
Hans Bauer
</button>
</ui-searchbox-autocomplete> </ui-searchbox-autocomplete>
</ui-searchbox> </ui-searchbox>
</div> </div>

View File

@@ -13,6 +13,7 @@
.card-create-customer, .card-create-customer,
.card-search-customer { .card-search-customer {
@apply bg-white rounded p-4 text-center; @apply bg-white rounded p-4 text-center;
box-shadow: 0 -2px 24px 0 #dce2e9; box-shadow: 0 -2px 24px 0 #dce2e9;
} }
@@ -30,4 +31,8 @@ ui-searchbox {
[uiSearchboxSearchButton] { [uiSearchboxSearchButton] {
@apply bg-brand text-white; @apply bg-brand text-white;
} }
[uiSearchboxClearButton] {
@apply text-inactive-customer;
}
} }

View File

@@ -1,4 +1,8 @@
import { Component, ChangeDetectionStrategy } from '@angular/core'; import {
Component,
ChangeDetectionStrategy,
ChangeDetectorRef,
} from '@angular/core';
@Component({ @Component({
selector: 'page-customer-search', selector: 'page-customer-search',
@@ -7,5 +11,11 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class CustomerSearchComponent { export class CustomerSearchComponent {
constructor() {} constructor(public cdr: ChangeDetectorRef) {}
onChange(queryString: string) {
console.log({ queryString });
this.cdr.detectChanges();
// handle autocompete, etc.
}
} }

View File

@@ -1,4 +1,4 @@
:host() { :host {
position: relative; position: relative;
height: 100%; height: 100%;
display: flex; display: flex;
@@ -100,6 +100,7 @@ img {
margin-left: auto; margin-left: auto;
min-width: 170px; min-width: 170px;
margin-right: 20px; margin-right: 20px;
span { span {
font-family: 'Open Sans'; font-family: 'Open Sans';
font-size: 14px; font-size: 14px;
@@ -113,7 +114,7 @@ img {
padding-left: 40px; padding-left: 40px;
} }
/* /*
##Device = Big Desktops ##Device = Big Desktops
*/ */
@media (min-width: 1281px) { @media (min-width: 1281px) {
@@ -130,7 +131,7 @@ img {
} }
} }
/* /*
##Device = Laptops, Desktops, Ipad pro ##Device = Laptops, Desktops, Ipad pro
*/ */
@media (min-width: 1025px) and (max-width: 1280px) { @media (min-width: 1025px) and (max-width: 1280px) {
@@ -147,7 +148,7 @@ img {
} }
} }
/* /*
##Device = Tablets, Ipads ##Device = Tablets, Ipads
*/ */
@media (min-width: 768px) and (max-width: 1024px) { @media (min-width: 768px) and (max-width: 1024px) {

View File

@@ -1,4 +1,4 @@
:host() { :host {
position: relative; position: relative;
height: 100%; height: 100%;
display: flex; display: flex;
@@ -101,6 +101,7 @@ img {
margin-left: auto; margin-left: auto;
min-width: 170px; min-width: 170px;
margin-right: 20px; margin-right: 20px;
span { span {
font-family: 'Open Sans'; font-family: 'Open Sans';
font-size: 14px; font-size: 14px;
@@ -110,7 +111,7 @@ img {
} }
} }
/* /*
##Device = Big Desktops ##Device = Big Desktops
*/ */
@media (min-width: 1281px) { @media (min-width: 1281px) {
@@ -127,7 +128,7 @@ img {
} }
} }
/* /*
##Device = Laptops, Desktops, Ipad pro ##Device = Laptops, Desktops, Ipad pro
*/ */
@media (min-width: 1025px) and (max-width: 1280px) { @media (min-width: 1025px) and (max-width: 1280px) {
@@ -144,7 +145,7 @@ img {
} }
} }
/* /*
##Device = Tablets, Ipads ##Device = Tablets, Ipads
*/ */
@media (min-width: 768px) and (max-width: 1024px) { @media (min-width: 768px) and (max-width: 1024px) {

View File

@@ -1,6 +1,5 @@
:host() { :host {
position: relative; position: relative;
height: 100%;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 80px; height: 80px;
@@ -113,7 +112,7 @@ img {
} }
} }
/* /*
##Device = Big Desktops ##Device = Big Desktops
*/ */
@media (min-width: 1281px) { @media (min-width: 1281px) {
@@ -130,7 +129,7 @@ img {
} }
} }
/* /*
##Device = Laptops, Desktops, Ipad pro ##Device = Laptops, Desktops, Ipad pro
*/ */
@media (min-width: 1025px) and (max-width: 1280px) { @media (min-width: 1025px) and (max-width: 1280px) {
@@ -147,7 +146,7 @@ img {
} }
} }
/* /*
##Device = Tablets, Ipads ##Device = Tablets, Ipads
*/ */
@media (min-width: 768px) and (max-width: 1024px) { @media (min-width: 768px) and (max-width: 1024px) {

View File

@@ -1,6 +1,5 @@
:host() { :host {
position: relative; position: relative;
height: 100%;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 80px; height: 80px;
@@ -113,7 +112,7 @@ img {
} }
} }
/* /*
##Device = Big Desktops ##Device = Big Desktops
*/ */
@media (min-width: 1281px) { @media (min-width: 1281px) {
@@ -130,7 +129,7 @@ img {
} }
} }
/* /*
##Device = Laptops, Desktops, Ipad pro ##Device = Laptops, Desktops, Ipad pro
*/ */
@media (min-width: 1025px) and (max-width: 1280px) { @media (min-width: 1025px) and (max-width: 1280px) {
@@ -147,7 +146,7 @@ img {
} }
} }
/* /*
##Device = Tablets, Ipads ##Device = Tablets, Ipads
*/ */
@media (min-width: 768px) and (max-width: 1024px) { @media (min-width: 768px) and (max-width: 1024px) {

View File

@@ -1,4 +1,4 @@
:host() { :host {
display: block; display: block;
position: relative; position: relative;
width: 69px; width: 69px;

View File

@@ -1,4 +1,4 @@
:host() { :host {
display: block; display: block;
position: relative; position: relative;
width: 69px; width: 69px;

View File

@@ -1,4 +1,11 @@
import { Component, ChangeDetectionStrategy, ContentChildren, QueryList, AfterContentInit, ChangeDetectorRef } from '@angular/core'; import {
Component,
ChangeDetectionStrategy,
ContentChildren,
QueryList,
AfterContentInit,
ChangeDetectorRef,
} from '@angular/core';
import { UiSearchboxAutocompleteOptionDirective } from './ui-searchbox-autocomplete-option.directive'; import { UiSearchboxAutocompleteOptionDirective } from './ui-searchbox-autocomplete-option.directive';
@Component({ @Component({
@@ -8,9 +15,11 @@ import { UiSearchboxAutocompleteOptionDirective } from './ui-searchbox-autocompl
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class UiSearchboxAutocompleteComponent implements AfterContentInit { export class UiSearchboxAutocompleteComponent implements AfterContentInit {
protected show = false; public show = false;
@ContentChildren(UiSearchboxAutocompleteOptionDirective, { read: UiSearchboxAutocompleteOptionDirective }) @ContentChildren(UiSearchboxAutocompleteOptionDirective, {
read: UiSearchboxAutocompleteOptionDirective,
})
options: QueryList<UiSearchboxAutocompleteOptionDirective>; options: QueryList<UiSearchboxAutocompleteOptionDirective>;
onSelect = (value: string) => {}; onSelect = (value: string) => {};
@@ -27,7 +36,9 @@ export class UiSearchboxAutocompleteComponent implements AfterContentInit {
} }
registerOptionOnSelect() { registerOptionOnSelect() {
this.options.forEach((option) => option.registerOnSelect((value) => this.selectValue(value))); this.options.forEach((option) =>
option.registerOnSelect((value) => this.selectValue(value))
);
} }
registerOnSelect(fn: any) { registerOnSelect(fn: any) {

View File

@@ -1,8 +1,12 @@
<div class="ui-searchbox-wrapper" [class.autocomplete-visible]="autocomplete?.show"> <div
class="ui-searchbox-wrapper"
[class.autocomplete-visible]="autocomplete?.show"
>
<div class="ui-searchbox-input-wrapper"> <div class="ui-searchbox-input-wrapper">
<ng-content select="[uiSearchboxInput]"></ng-content> <ng-content select="[uiSearchboxInput]"></ng-content>
<ng-content select="ui-searchbox-warning"></ng-content> <ng-content select="ui-searchbox-warning"></ng-content>
</div> </div>
<ng-content select="[uiSearchboxClearButton]"></ng-content>
<ng-content select="[uiSearchboxSearchButton]"></ng-content> <ng-content select="[uiSearchboxSearchButton]"></ng-content>
</div> </div>
<ng-content select="ui-searchbox-autocomplete"></ng-content> <ng-content select="ui-searchbox-autocomplete"></ng-content>

View File

@@ -4,6 +4,7 @@
.ui-searchbox-wrapper { .ui-searchbox-wrapper {
@apply flex flex-row rounded-autocomplete bg-white shadow-input; @apply flex flex-row rounded-autocomplete bg-white shadow-input;
height: 60px; height: 60px;
&.autocomplete-visible { &.autocomplete-visible {
@@ -32,12 +33,18 @@
} }
} }
.ui-searchbox-wrapper ::ng-deep [uiSearchboxSearchButton] { .ui-searchbox-wrapper ::ng-deep [uiSearchboxSearchButton],
.ui-searchbox-wrapper ::ng-deep [uiSearchboxClearButton] {
@apply flex flex-row justify-center items-center rounded-full border-0 text-center bg-white; @apply flex flex-row justify-center items-center rounded-full border-0 text-center bg-white;
height: 60px; height: 60px;
width: 60px; width: 60px;
} }
.ui-searchbox-wrapper ::ng-deep [uiSearchboxClearButton] {
@apply mr-2;
width: auto;
}
:host ::ng-deep ui-searchbox-autocomplete { :host ::ng-deep ui-searchbox-autocomplete {
@apply absolute left-0 right-0 z-dropdown; @apply absolute left-0 right-0 z-dropdown;
top: 60px; top: 60px;

View File

@@ -1,4 +1,4 @@
:host() { :host {
display: flex; display: flex;
position: relative; position: relative;
width: 100%; width: 100%;
@@ -7,6 +7,7 @@
justify-content: center; justify-content: center;
margin-top: 30%; margin-top: 30%;
} }
span { span {
margin-top: 16px; margin-top: 16px;
font-family: 'Open Sans'; font-family: 'Open Sans';
@@ -14,6 +15,7 @@ span {
font-size: 16px; font-size: 16px;
color: rgba(90, 114, 138, 1); color: rgba(90, 114, 138, 1);
} }
.rotate { .rotate {
margin-top: 10px; margin-top: 10px;
animation: spin 1.5s linear infinite; animation: spin 1.5s linear infinite;

1658
package-lock.json generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -109,6 +109,8 @@
"prettier": "2.0.1", "prettier": "2.0.1",
"pretty-quick": "^2.0.1", "pretty-quick": "^2.0.1",
"protractor": "~7.0.0", "protractor": "~7.0.0",
"stylelint": "^13.7.2",
"stylelint-config-standard": "^20.0.0",
"tailwindcss": "^1.6.3", "tailwindcss": "^1.6.3",
"ts-node": "~7.0.0", "ts-node": "~7.0.0",
"tslint": "~6.1.0", "tslint": "~6.1.0",

19
stylelint.config.js Normal file
View File

@@ -0,0 +1,19 @@
module.exports = {
//extends: ['stylelint-config-standard'],
rules: {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'tailwind',
'apply',
'variants',
'responsive',
'screen',
],
},
],
'declaration-block-trailing-semicolon': null,
'no-descending-specificity': null,
},
};