diff --git a/src/app/app.module.ts b/src/app/app.module.ts index dab925f..668c692 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -10,6 +10,7 @@ import { OrdersComponent } from './orders/orders.component'; import { MenuItemsComponent } from './menu-items/menu-items.component'; import { OffersComponent } from './offers/offers.component'; import { SchedulesComponent } from './schedules/schedules.component'; +import { CustomSelectorComponent } from './custom-selector/custom-selector.component'; @NgModule({ declarations: [ @@ -20,7 +21,8 @@ import { SchedulesComponent } from './schedules/schedules.component'; OrdersComponent, MenuItemsComponent, OffersComponent, - SchedulesComponent + SchedulesComponent, + CustomSelectorComponent ], imports: [ BrowserModule, diff --git a/src/app/custom-selector/custom-selector.component.html b/src/app/custom-selector/custom-selector.component.html new file mode 100644 index 0000000..379fd54 --- /dev/null +++ b/src/app/custom-selector/custom-selector.component.html @@ -0,0 +1,15 @@ +
+
+
+ {{ header }}: {{ selectedOption.name }} +
+ +
+ +
diff --git a/src/app/custom-selector/custom-selector.component.scss b/src/app/custom-selector/custom-selector.component.scss new file mode 100644 index 0000000..803a7d5 --- /dev/null +++ b/src/app/custom-selector/custom-selector.component.scss @@ -0,0 +1,54 @@ +.selector { + .container { + display: flex; + width: 100%; + border-radius: 20px; + background-color: white; + color: var(--brand-blue); + align-items: center; + justify-content: space-between; + + .selected-value { + font-weight: 500; + margin-left: 20px; + font-size: 14px; + + span { + margin-left: 5px; + } + } + + button { + border-radius: 50%; + width: 30px; + height: 30px; + color: var(--brand-blue); + font-size: 20px; + border: 1px solid var(--brand-blue); + background-color: white; + } + } + + ul { + list-style: none; + background-color: white; + width: 80%; + margin: 0 auto; + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; + overflow: hidden; + } + + li { + padding: 10px; + font-size: 14px; + color: var(--brand-blue); + cursor: pointer; + transition: background-color 0.3s, color 0.3s; + + &:hover { + background-color: var(--brand-blue); + color: white; + } + } +} diff --git a/src/app/custom-selector/custom-selector.component.spec.ts b/src/app/custom-selector/custom-selector.component.spec.ts new file mode 100644 index 0000000..c2af372 --- /dev/null +++ b/src/app/custom-selector/custom-selector.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CustomSelectorComponent } from './custom-selector.component'; + +describe('CustomSelectorComponent', () => { + let component: CustomSelectorComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CustomSelectorComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CustomSelectorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/custom-selector/custom-selector.component.ts b/src/app/custom-selector/custom-selector.component.ts new file mode 100644 index 0000000..91548dc --- /dev/null +++ b/src/app/custom-selector/custom-selector.component.ts @@ -0,0 +1,28 @@ +import { Component, OnInit, Input } from '@angular/core'; + +@Component({ + selector: 'app-custom-selector', + templateUrl: './custom-selector.component.html', + styleUrls: ['./custom-selector.component.scss'] +}) +export class CustomSelectorComponent implements OnInit { + @Input() width: number; + @Input() options: Array<{ + name: string, + id: string + }>; + @Input() header: string; + @Input() defaultOptionId: string; + selectedOption: { + name: string, + id: string + }; + showDropdown: boolean = false; + + constructor() { } + + ngOnInit() { + this.selectedOption = this.options.find(option => option.id === this.defaultOptionId); + } + +} diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 528cb31..fa07226 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -2,6 +2,8 @@
Dashboard
+