-
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 key event functionality
- Loading branch information
patrickjahr
committed
Apr 18, 2024
1 parent
db594bc
commit 9d368c3
Showing
24 changed files
with
363 additions
and
256 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { animate, AnimationMetadata, style } from '@angular/animations'; | ||
|
||
export const fadeFactory = ( | ||
from: number, | ||
to: number, | ||
duration = '200ms' | ||
): AnimationMetadata[] => { | ||
return [ | ||
style({ opacity: from }), | ||
animate(`${duration} ease`, style({ opacity: to })), | ||
]; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { animate, AnimationMetadata, style } from '@angular/animations'; | ||
|
||
export const zoomFactory = ( | ||
from: number, | ||
to: number, | ||
duration = '500ms' | ||
): AnimationMetadata[] => { | ||
return [ | ||
style({ opacity: from, scale: from }), | ||
animate( | ||
`${duration} cubic-bezier(0.05, 0.7, 0.1, 1)`, | ||
style({ opacity: to, scale: to }) | ||
), | ||
]; | ||
}; |
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
46 changes: 27 additions & 19 deletions
46
...app/src/app/pages/select-sample/select-options-sample/select-options-sample.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 |
---|---|---|
@@ -1,33 +1,41 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
margin-top: 0.5rem; | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
max-height: 200px; | ||
margin-top: 0.5rem; | ||
overflow-x: auto; | ||
} | ||
|
||
sk-select-option { | ||
background-color: #fff; | ||
color: #000; | ||
padding: 0.5rem 1rem; | ||
cursor: pointer; | ||
transition: color 0.3s ease-in-out, font-weight 0.3s ease-in-out, | ||
font-size 0.3s ease-in-out; | ||
display: flex; | ||
gap: 0.5rem; | ||
background-color: #fff; | ||
color: #000; | ||
padding: 0.5rem 1rem; | ||
cursor: pointer; | ||
transition: color 0.3s ease-in-out, font-weight 0.3s ease-in-out; | ||
} | ||
|
||
sk-select-option:first-child { | ||
border-top-left-radius: 0.25rem; | ||
border-top-right-radius: 0.25rem; | ||
border-top-left-radius: 0.25rem; | ||
border-top-right-radius: 0.25rem; | ||
} | ||
|
||
sk-select-option:last-child { | ||
border-bottom-left-radius: 0.25rem; | ||
border-bottom-right-radius: 0.25rem; | ||
border-bottom-left-radius: 0.25rem; | ||
border-bottom-right-radius: 0.25rem; | ||
} | ||
|
||
@media (hover) { | ||
sk-select-option:hover { | ||
color: deeppink; | ||
font-weight: bold; | ||
font-size: 1.5em; | ||
} | ||
sk-select-option:hover { | ||
color: var(--sk-primary-color); | ||
font-weight: bold; | ||
} | ||
} | ||
|
||
sk-select-option:focus { | ||
border: none; | ||
color: var(--sk-primary-color); | ||
font-weight: bold; | ||
} |
11 changes: 6 additions & 5 deletions
11
...pp/src/app/pages/select-sample/select-options-sample/select-options-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,5 +1,6 @@ | ||
<sk-select-option [value]="{ data: 1 }">Test 1</sk-select-option> | ||
<sk-select-option [value]="{ data: 2 }">Test 2</sk-select-option> | ||
<sk-select-option [value]="{ data: 3 }">Test 3</sk-select-option> | ||
<sk-select-option [value]="{ data: 4 }">Test 4</sk-select-option> | ||
<sk-select-option [value]="{ data: 5 }">Test 5</sk-select-option> | ||
@for (option of options(); track option.value) { | ||
<sk-select-option [value]="option.value"> | ||
<fa-icon [icon]="option.icon"></fa-icon> | ||
<span>{{ option.label }}</span> | ||
</sk-select-option> | ||
} |
6 changes: 5 additions & 1 deletion
6
...src/app/pages/select-sample/select-options-sample/select-options-sample.component.spec.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
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
75 changes: 47 additions & 28 deletions
75
apps/demo-app/src/app/pages/select-sample/select-sample.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 |
---|---|---|
@@ -1,51 +1,70 @@ | ||
sk-select { | ||
display: block; | ||
margin-top: 1rem; | ||
display: block; | ||
margin-top: 1rem; | ||
} | ||
|
||
.sk-label { | ||
padding: 0.5rem 1rem; | ||
border-radius: 8px; | ||
background: rgba(255, 255, 255, 0.1); | ||
color: #fefefe; | ||
box-shadow: rgba(255, 255, 255, 0.05) 0px 6px 24px 0px, rgba(255, 255, 255, 0.08) 0px 0px 0px 1px; | ||
} | ||
display: flex; | ||
align-items: center; | ||
gap: 0.25rem; | ||
padding: 0.5rem 1rem; | ||
border-radius: 8px; | ||
background: rgb(255 255 255 / 10%); | ||
color: #fefefe; | ||
box-shadow: rgb(255 255 255 / 5%) 0 6px 24px 0, | ||
rgb(255 255 255 / 8%) 0 0 0 1px; | ||
|
||
.sk-options { | ||
.sk-label-item { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 0.25rem; | ||
width: 100%; | ||
margin-top: 0.5rem; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
max-width: 90%; | ||
|
||
fa-icon { | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
} | ||
} | ||
} | ||
|
||
.sk-options { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.25rem; | ||
width: 100%; | ||
margin-top: 0.5rem; | ||
} | ||
|
||
sk-select-option { | ||
background-color: #fff; | ||
color: #000; | ||
padding: 0.5rem 1rem; | ||
cursor: pointer; | ||
transition: color 0.3s ease-in-out, font-weight 0.3s ease-in-out, | ||
background-color: #fff; | ||
color: #000; | ||
padding: 0.5rem 1rem; | ||
cursor: pointer; | ||
transition: color 0.3s ease-in-out, font-weight 0.3s ease-in-out, | ||
font-size 0.3s ease-in-out; | ||
} | ||
|
||
sk-select-option:first-child { | ||
border-top-left-radius: 0.25rem; | ||
border-top-right-radius: 0.25rem; | ||
border-top-left-radius: 0.25rem; | ||
border-top-right-radius: 0.25rem; | ||
} | ||
|
||
sk-select-option:last-child { | ||
border-bottom-left-radius: 0.25rem; | ||
border-bottom-right-radius: 0.25rem; | ||
border-bottom-left-radius: 0.25rem; | ||
border-bottom-right-radius: 0.25rem; | ||
} | ||
|
||
@media (hover) { | ||
sk-select-option:hover { | ||
color: deeppink; | ||
font-weight: bold; | ||
font-size: 1.5em; | ||
} | ||
sk-select-option:hover { | ||
color: deeppink; | ||
font-weight: bold; | ||
font-size: 1.5em; | ||
} | ||
} | ||
|
||
sk-select-option:not(:last-child) { | ||
border-bottom: 1px solid #000; | ||
} | ||
border-bottom: 1px solid #000; | ||
} |
Oops, something went wrong.