-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(select): add sample and default style
- Loading branch information
patrickjahr
committed
Apr 18, 2024
1 parent
c326877
commit 680599a
Showing
21 changed files
with
324 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
apps/demo-app/src/app/pages/select-sample/select-default/select-default.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<sk-select [(ngModel)]="selectedValue"> | ||
<span skSelectPlaceholder>Select option</span> | ||
<span skSelectLabel>{{ selectedValue?.label }}</span> | ||
@for (option of options; track option.value) { | ||
<sk-select-option [value]="option"> | ||
{{ option.label }} | ||
</sk-select-option> | ||
} | ||
</sk-select> |
39 changes: 39 additions & 0 deletions
39
apps/demo-app/src/app/pages/select-sample/select-default/select-default.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Component } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { SelectDemoOption } from '../select-sample.component'; | ||
import { | ||
faBell, | ||
faCog, | ||
faEnvelope, | ||
faGlobe, | ||
faHeart, | ||
faHome, | ||
faKey, | ||
faLock, | ||
faStar, | ||
faUser, | ||
} from '@fortawesome/free-solid-svg-icons'; | ||
import { SelectComponent, SelectOptionComponent } from '@qupaya/sketch'; | ||
import { FormsModule } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'app-select-default', | ||
standalone: true, | ||
imports: [CommonModule, SelectComponent, SelectOptionComponent, FormsModule], | ||
templateUrl: './select-default.component.html', | ||
}) | ||
export class SelectDefaultComponent { | ||
readonly options: SelectDemoOption[] = [ | ||
{ label: 'Option 1', icon: faHome, value: 1 }, | ||
{ label: 'Option 2', icon: faUser, value: 2 }, | ||
{ label: 'Option 3', icon: faCog, value: 3 }, | ||
{ label: 'Option 4', icon: faHeart, value: 4 }, | ||
{ label: 'Option 5', icon: faStar, value: 5 }, | ||
{ label: 'Option 6', icon: faBell, value: 6 }, | ||
{ label: 'Option 7', icon: faEnvelope, value: 7 }, | ||
{ label: 'Option 8', icon: faGlobe, value: 8 }, | ||
{ label: 'Option 9', icon: faLock, value: 9 }, | ||
{ label: 'Option 10', icon: faKey, value: 10 }, | ||
]; | ||
selectedValue?: SelectDemoOption; | ||
} |
31 changes: 0 additions & 31 deletions
31
apps/demo-app/src/app/pages/select-sample/select-sample.component.css
This file was deleted.
Oops, something went wrong.
26 changes: 1 addition & 25 deletions
26
apps/demo-app/src/app/pages/select-sample/select-sample.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1 @@ | ||
Multiple: <input type="checkbox" (change)="switchMultiple($event)" /> | ||
|
||
<sk-select | ||
[ngModel]="value" | ||
(ngModelChange)="valueChanged($event)" | ||
[multiple]="multiple()" | ||
[animationDelay]="250" | ||
[closeOnSelect]="true" | ||
(open)="showAnimation.set($event)" | ||
> | ||
<div class="sk-label" skSelectPlaceholder>Please select an option</div> | ||
<div class="sk-label" skSelectLabel> | ||
<div class="sk-label-item"> | ||
@for (item of selectedValues(); track item.value) { @if | ||
(selectedValues().length <= 1) { | ||
<fa-icon [icon]="item.icon"></fa-icon> | ||
} | ||
{{ item.label }} | ||
} | ||
</div> | ||
</div> | ||
|
||
<app-select-options-sample [options]="options" [show]="showAnimation()"> | ||
</app-select-options-sample> | ||
</sk-select> | ||
<router-outlet></router-outlet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
apps/demo-app/src/app/pages/select-sample/select-with-style/select-with-style.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
sk-select { | ||
--sk-select-label-background: rgb(255 255 255 / 10%); | ||
--sk-select-label-color: #fefefe; | ||
--sk-select-label-padding: 0; | ||
--sk-select-label-border-radius: 8px; | ||
--sk-select-label-border-color: transparent; | ||
--sk-select-label-border-focus-color: deeppink; | ||
|
||
display: block; | ||
margin-top: 1rem; | ||
} | ||
|
||
.sk-label { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
gap: 0.25rem; | ||
border-radius: 8px; | ||
padding: 0.5rem 1rem; | ||
box-shadow: rgb(255 255 255 / 5%) 0 6px 24px 0, | ||
rgb(255 255 255 / 8%) 0 0 0 1px; | ||
} | ||
|
||
.sk-label .sk-arrow { | ||
transform: rotate(0); | ||
transition: transform 0.3s ease-in-out; | ||
} | ||
|
||
.sk-label.open .sk-arrow { | ||
transform: rotate(180deg); | ||
} | ||
|
||
.sk-label .sk-label-item { | ||
display: flex; | ||
align-items: center; | ||
gap: 0.25rem; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
max-width: 90%; | ||
} | ||
|
||
fa-icon { | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
} |
29 changes: 29 additions & 0 deletions
29
apps/demo-app/src/app/pages/select-sample/select-with-style/select-with-style.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Multiple: <input type="checkbox" (change)="switchMultiple($event)" /> | ||
|
||
<sk-select | ||
[ngModel]="value" | ||
(ngModelChange)="valueChanged($event)" | ||
[multiple]="multiple()" | ||
[animationDelay]="250" | ||
[closeOnSelect]="!multiple()" | ||
(open)="showAnimation.set($event)" | ||
> | ||
<div class="sk-label" [class.open]="showAnimation()" skSelectPlaceholder> | ||
<span>Please select an option</span> | ||
<fa-icon class="sk-arrow" [icon]="faArrowAltCircleDown"></fa-icon> | ||
</div> | ||
<div class="sk-label" [class.open]="showAnimation()" skSelectLabel> | ||
<div class="sk-label-item"> | ||
@for (item of selectedValues(); track item.value) { @if | ||
(selectedValues().length <= 1) { | ||
<fa-icon [icon]="item.icon"></fa-icon> | ||
} | ||
{{ item.label }} | ||
} | ||
</div> | ||
<fa-icon class="sk-arrow" [icon]="faArrowAltCircleDown"></fa-icon> | ||
</div> | ||
|
||
<app-select-options-sample [options]="options" [show]="showAnimation()"> | ||
</app-select-options-sample> | ||
</sk-select> |
Oops, something went wrong.