Skip to content

Commit

Permalink
Revamp search styling
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Jul 6, 2022
1 parent fba08e7 commit 702bb2a
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ THE SOFTWARE.
<dialog id="command-palette" class="jenkins-command-palette__dialog">
<div class="jenkins-command-palette__wrapper">
<div class="jenkins-command-palette">
<div class="jenkins-command-palette__search">
<div class="icon">
<l:icon src="symbol-search" />
</div>
<input id="command-bar" placeholder="${%Search}" type="search" autocomplete="off" autocorrect="off"
<div class="jenkins-search jenkins-command-palette__search">
<input id="command-bar" class="jenkins-search__input" placeholder="${%Search}" type="search"
autocomplete="off" autocorrect="off"
autocapitalize="off" spellcheck="false" />
<div class="keyboard-shortcuts" id="command-palette-keyboard-shortcut">

<div class="jenkins-search__icon">
<l:icon src="symbol-search" />
</div>
</div>
<div id="search-results-container" class="jenkins-command-palette__results-container">
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/layout/layout.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ THE SOFTWARE.
</head>
<body id="jenkins" class="yui-skin-sam ${layoutType} jenkins-${h.version}" data-version="${h.version}" data-model-type="${it.class.name}">

<l:search />
<l:command-palette />

<j:if test="${layoutType!='full-screen'}">
<!-- for accessibility, skip the entire navigation bar and etc and go straight to the head of the content -->
Expand Down
6 changes: 3 additions & 3 deletions war/src/main/js/components/command-palette/command-palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ window.addEventListener('load', () => {
const commandPalette = document.getElementById("command-palette")
const commandPaletteWrapper = commandPalette.querySelector(".jenkins-command-palette__wrapper")
const commandPaletteInput = document.getElementById("command-bar")
const commandPaletteLoadingSymbol = commandPalette.querySelector(".jenkins-command-palette__search .icon")
const commandPaletteSearchBarContainer = commandPalette.querySelector(".jenkins-command-palette__search")
const searchResults = document.getElementById("search-results")
const searchResultsContainer = document.getElementById("search-results-container")

Expand Down Expand Up @@ -92,11 +92,11 @@ window.addEventListener('load', () => {
}

searchResultsContainer.style.height = searchResults.offsetHeight + "px"
commandPaletteLoadingSymbol.classList.remove("icon--loading")
commandPaletteSearchBarContainer.classList.remove("jenkins-search--loading")
}

commandPaletteInput.addEventListener("input", () => {
commandPaletteLoadingSymbol.classList.add("icon--loading")
commandPaletteSearchBarContainer.classList.add("jenkins-search--loading")
debounce(renderResults, 200)()
})

Expand Down
1 change: 1 addition & 0 deletions war/src/main/less/abstracts/mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
.item() {
position: relative;
z-index: 0;
text-decoration: none !important;

&::before, &::after {
position: absolute;
Expand Down
106 changes: 54 additions & 52 deletions war/src/main/less/form/search.less
Original file line number Diff line number Diff line change
Expand Up @@ -63,68 +63,70 @@

&__icon {
position: absolute;
top: 9px;
left: 9px;
width: 16px;
height: 16px;
fill: var(--input-border-hover);
transition: var(--standard-transition);
}
aspect-ratio: 1 / 1;
top: 0;
left: 0;
bottom: 0;
display: grid;
pointer-events: none;

svg {
width: 45%;
height: 45%;
max-width: 1.1rem;
max-height: 1.1rem;
grid-column-start: 1;
grid-row-start: 1;
justify-self: center;
align-self: center;
transition: var(--standard-transition);
}

&::before {
content: "";
position: absolute;
top: 17px;
left: 17px;
width: 0;
height: 0;
color: inherit;
border: 2px solid currentColor;
border-radius: 100%;
opacity: 0;
transition: var(--standard-transition);
}
&::before, &::after {
content: "";
width: 0;
height: 0;
max-width: 1.1rem;
max-height: 1.1rem;
border: 0.125rem solid currentColor;
border-radius: 100%;
transition: var(--standard-transition);
grid-column-start: 1;
grid-row-start: 1;
justify-self: center;
align-self: center;
opacity: 0;
}

&::after {
content: "";
position: absolute;
top: 17px;
left: 17px;
width: 0;
height: 0;
color: inherit;
border: 2px solid currentColor;
border-radius: 100%;
clip-path: inset(0 0 50% 50%);
opacity: 0;
transition: var(--standard-transition);
animation: loading-spinner 1s infinite linear;
&::after {
clip-path: inset(0 0 50% 50%);
transition: var(--standard-transition);
animation: loading-spinner 1s infinite linear;

@media (prefers-reduced-motion) {
animation-duration: 2s;
@media (prefers-reduced-motion) {
animation-duration: 2s;
}
}
}

&--loading {
.jenkins-search__icon {
opacity: 0;
transform: scale(0);
}
svg {
opacity: 0;
transform: scale(0);
}

&::before {
opacity: 0.2;
top: 9px;
left: 9px;
width: 16px;
height: 16px;
}
&::before {
opacity: 0.2;
width: 45%;
height: 45%;
}

&::after {
opacity: 1;
top: 9px;
left: 9px;
width: 16px;
height: 16px;
&::after {
opacity: 1;
width: 45%;
height: 45%;
}
}
}

Expand Down
Loading

0 comments on commit 702bb2a

Please sign in to comment.