Skip to content

Commit f6c00bb

Browse files
committed
Added styles and tabs in mobile filter component
1 parent 095c41d commit f6c00bb

File tree

10 files changed

+160
-49
lines changed

10 files changed

+160
-49
lines changed

src/app/modules/search/components/mobile-filters-container/components/mobile-filter-list/mobile-filter-list.component.html

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
<!-- <h4>This is mobile filter list component</h4> -->
22

3-
<a type="" class="testbtn" (click)="openModal(filterModal)">
4-
FILTER
5-
</a>
3+
<span type="" class="" (click)="openModal(filterModal)">
4+
<i class="fa fa-filter mr-1"></i> FILTER
5+
</span>
66

77
<ng-template #filterModal>
88
<div class="modal-header">
99
<div class="text-left">
1010
<h4 class="modal-title">Filters</h4>
1111
</div>
12-
<div class="text-right">
12+
<div class="text-right pr-0">
1313
<a class="clear-filter-btn">Clear all</a>
1414
</div>
1515
</div>
16-
<div class="modal-body">
17-
<div class="row">
18-
<div class="col-4 p-0">
19-
<ul class="filter-list">
20-
<li *ngFor="let filterItem of filterItems; let i = index">
21-
{{ filterItem }}
22-
</li>
23-
</ul>
24-
</div>
25-
<div class="col-8">
26-
Tabs
27-
</div>
28-
</div>
16+
<div class="modal-body p-0">
17+
<tabset [vertical]="true" class="filter-tabs">
18+
<tab
19+
*ngFor="let tabz of tabs"
20+
[heading]="tabz.title"
21+
[customClass]="tabz.customClass"
22+
>
23+
<div class="col">{{ tabz?.content }}</div>
24+
</tab>
25+
</tabset>
2926
</div>
3027
<div class="modal-footer">
3128
<div>
Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
.filter-list {
22
list-style: none;
33
li {
4-
display: block;
5-
border-bottom: 1px solid #ddd;
6-
width: 100%;
7-
line-height: 24px;
8-
padding: 10px;
4+
border-bottom: 1px solid #eaeaec;
5+
padding: 0 15px;
6+
min-height: 50px;
7+
display: -webkit-box;
8+
display: -ms-flexbox;
9+
display: flex;
10+
-webkit-box-align: center;
11+
-ms-flex-align: center;
12+
align-items: center;
13+
14+
&.active {
15+
border-left: 2px solid #ff3e6c;
16+
background: white;
17+
font-weight: bold;
18+
}
919
}
1020
}
11-
.modal-header {
21+
span {
22+
height: 100%;
23+
display: block;
1224
}

src/app/modules/search/components/mobile-filters-container/components/mobile-filter-list/mobile-filter-list.component.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,26 @@ import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
1010
export class MobileFilterListComponent implements OnInit {
1111
modalRef: BsModalRef;
1212
filterItems = ['First', 'Second', 'Third'];
13-
config = { animated: true, class: 'modal-filter' };
13+
config = { animated: true, class: 'filter-modal' };
14+
tabs: any[] = [
15+
{
16+
title: this.filterItems[0],
17+
content: 'Dynamic content 1',
18+
customClass: 'customClass'
19+
},
20+
{
21+
title: this.filterItems[1],
22+
content: 'Dynamic content 2',
23+
customClass: 'customClass'
24+
},
25+
{
26+
title: this.filterItems[2],
27+
content: 'Dynamic content 3',
28+
customClass: 'customClass'
29+
}
30+
];
1431
constructor(private modalService: BsModalService) {}
32+
1533
ngOnInit() {}
1634
openModal(filterModal: TemplateRef<any>) {
1735
this.modalRef = this.modalService.show(filterModal, this.config);

src/app/modules/search/components/mobile-filters-container/components/mobile-sort-filter-list/mobile-sort-filter-list.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<a type="" class="" (click)="openModal(sortModal)">
2-
SORT
3-
</a>
1+
<span type="" class="" (click)="openModal(sortModal)">
2+
<i class="fa fa-sort mr-1"></i> SORT
3+
</span>
44

55
<ng-template #sortModal>
6-
<div class="modal-header">
7-
<h4 class="modal-title pull-left">Sort By</h4>
6+
<div class="modal-header p-0">
7+
<h4 class="modal-title float-left sort-header m-0">Sort By</h4>
88
</div>
99
<div class="modal-body">
1010
<ul class="sort-list">
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
.sort-list {
22
li {
3-
width: 100%;
4-
padding: 10px;
5-
text-align: left;
3+
display: block;
4+
line-height: 24px;
5+
padding: 15px 0;
6+
border-bottom: solid 1px #eaeaec;
7+
width: 82%;
68
font-size: 14px;
7-
border-bottom: 1px solid #d2d2d2;
9+
margin-left: 65px;
810
}
911
}
12+
13+
span {
14+
height: 100%;
15+
display: block;
16+
}
17+
18+
.sort-header {
19+
font-weight: bold;
20+
border: none;
21+
font-size: 18px;
22+
color: #3e4152;
23+
padding-left: 20px;
24+
padding-top: 12px;
25+
padding-bottom: 8px;
26+
}

src/app/modules/search/components/mobile-filters-container/components/mobile-sort-filter-list/mobile-sort-filter-list.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
99
})
1010
export class MobileSortFilterListComponent implements OnInit {
1111
modalRef: BsModalRef;
12-
sortItems = ['First', 'Second', 'Third'];
12+
sortItems = [
13+
' Popularity',
14+
' Latest',
15+
' Discount',
16+
' Price: High to Low',
17+
' Price: Low to High'
18+
];
1319
config = {
1420
animated: true,
15-
class: 'sort-filter'
21+
class: 'sort-modal'
1622
};
1723
constructor(private modalService: BsModalService) {}
1824

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<nav class="navbar fixed-bottom navbar-light bg-light mobile-bottom-nav">
2-
<a class="navbar-brand"
3-
><app-mobile-sort-filter-list></app-mobile-sort-filter-list>
2+
<a class="navbar-brand b-right">
3+
<app-mobile-sort-filter-list></app-mobile-sort-filter-list>
44
</a>
55
<a class="navbar-brand">
66
<app-mobile-filter-list> </app-mobile-filter-list>
77
</a>
88
</nav>
9-
10-
<div class="col"></div>

src/app/modules/search/components/mobile-filters-container/mobile-filters-container.component.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,19 @@
1616
float: left;
1717
text-transform: uppercase;
1818
cursor: pointer;
19+
position: relative;
20+
&.b-right {
21+
::after {
22+
position: absolute;
23+
top: 0;
24+
right: 0;
25+
width: 1px;
26+
background: #eaeaec;
27+
height: 22px;
28+
margin-top: 15px;
29+
content: '';
30+
z-index: 1;
31+
}
32+
}
1933
}
2034
}

src/app/shared/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { RandomPipe } from './pipes/random.pipe';
1515
// components
1616
// imports
1717
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
18+
import { TabsModule } from 'ngx-bootstrap/tabs';
1819
import { RatingModule } from 'ngx-bootstrap/rating';
1920
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
2021
import { ProductSliderComponent } from './components/product-slider/product-slider.component';
@@ -49,6 +50,7 @@ import { SanitizeHtmlPipe } from './pipes/sanitize-html.pipe';
4950
// modules
5051
CommonModule,
5152
BsDropdownModule,
53+
TabsModule,
5254
RatingModule,
5355
TypeaheadModule,
5456
FormsModule,
@@ -74,6 +76,7 @@ import { SanitizeHtmlPipe } from './pipes/sanitize-html.pipe';
7476
CommonModule,
7577
BsDropdownModule.forRoot(),
7678
TypeaheadModule.forRoot(),
79+
TabsModule.forRoot(),
7780
RatingModule.forRoot(),
7881
RouterModule,
7982
NgxInputStarRatingModule,

src/styles.scss

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ $l-max: 90;
117117
}
118118
}
119119

120-
.modal-filter {
120+
// modal css
121+
122+
.filter-modal {
121123
margin: 0;
122124
.modal-content {
123125
border: none;
@@ -129,16 +131,19 @@ $l-max: 90;
129131
width: 50%;
130132
float: left;
131133
display: block;
132-
padding: 10px 15px;
134+
padding: 13px 12px 10px 20px;
133135
text-transform: uppercase;
134-
font-size: 14px;
136+
font-size: 13px;
135137
font-weight: bold;
138+
height: 50px;
136139
.modal-title {
137-
font-size: 14px;
140+
font-size: 13px;
138141
}
139142
.clear-filter-btn {
140143
font-weight: 300;
141144
cursor: pointer;
145+
padding-right: 20px;
146+
color: #ff3e6c;
142147
}
143148
}
144149
}
@@ -163,21 +168,62 @@ $l-max: 90;
163168
}
164169
}
165170

166-
.sort-filter {
171+
.sort-modal {
172+
position: fixed;
173+
width: 100%;
174+
bottom: 0;
167175
margin: 0;
168176
.modal-content {
169177
border: none;
170178
border-radius: 0;
171-
height: 70vh;
172-
@at-root body.modal-open .modal {
173-
padding-top: 30vh;
174-
}
179+
// @at-root body.modal-open .modal {
180+
// padding-top: 30vh;
181+
// }
175182
.modal-header {
176-
padding: 10px;
183+
padding: 0px;
177184
text-transform: uppercase;
185+
border-bottom: none;
178186
}
179187
.modal-body {
180188
padding: 0;
181189
}
182190
}
183191
}
192+
193+
// filter container
194+
195+
.filter-tabs {
196+
background: red;
197+
.nav {
198+
padding: 0;
199+
height: 100%;
200+
overflow: scroll;
201+
border-right: 1px solid #eaeaec;
202+
width: 33.33%;
203+
float: left;
204+
border-bottom: none;
205+
li {
206+
margin-bottom: 0;
207+
a {
208+
background: #f5f5f6;
209+
font-size: 14px;
210+
border-bottom: 1px solid #eaeaec;
211+
padding: 0 15px;
212+
min-height: 50px;
213+
display: -webkit-box;
214+
display: -ms-flexbox;
215+
display: flex;
216+
-webkit-box-align: center;
217+
-ms-flex-align: center;
218+
align-items: center;
219+
border-radius: 0;
220+
&.active {
221+
background: white;
222+
font-weight: bold;
223+
border: none;
224+
border-left: 2px solid #ff3e6c;
225+
}
226+
}
227+
}
228+
}
229+
}

0 commit comments

Comments
 (0)