From f9a5b6b76e9aef1f50dd878e982caff4d668e2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Mon, 8 Jun 2020 11:10:32 +0200 Subject: [PATCH] refactor(docsearch): format CSS --- src/style.css | 291 +++++++++++++++++++++++++------------------------- 1 file changed, 146 insertions(+), 145 deletions(-) diff --git a/src/style.css b/src/style.css index 00e8a8f95..197c075e9 100644 --- a/src/style.css +++ b/src/style.css @@ -1,15 +1,14 @@ /* Variables */ :root { - - --docsearch-primary-color: rgb(84,104,255); + --docsearch-primary-color: rgb(84, 104, 255); --docsearch-spacing: 12px; --docsearch-icon-stroke-width: 1.4; --docsearch-highlight-color: var(--docsearch-primary-color); --docsearch-text-color: var(--ifm-color-emphasis-900); --docsearch-muted-color: rgb(150, 159, 175); --docsearch-container-background: rgba(101, 108, 133, 0.8); - --docsearch-logo-color: rgba(84,104,255); + --docsearch-logo-color: rgba(84, 104, 255); /* modal */ --docsearch-modal-width: 560px; @@ -22,7 +21,8 @@ --docsearch-searchbox-height: 56px; --docsearch-searchbox-background: var(--ifm-color-emphasis-200); --docsearch-searchbox-focus-background: white; - --docsearch-searchbox-shadow: inset 0px 0px 0px 2px var(--docsearch-primary-color); + --docsearch-searchbox-shadow: inset 0px 0px 0px 2px + var(--docsearch-primary-color); /* hit */ --docsearch-hit-height: 56px; @@ -45,7 +45,6 @@ --docsearch-footer-background: white; --docsearch-footer-shadow: 0px -1px 0px 0px rgb(224, 227, 232), 0px -3px 6px 0px rgba(69, 98, 155, 0.12); - } /* Darkmode */ @@ -70,35 +69,35 @@ html[data-theme='dark'] { --docsearch-footer-background: rgb(30, 33, 54); --docsearch-footer-shadow: inset 0px 1px 0px 0px rgba(73, 76, 106, 0.5), 0px -4px 8px 0px rgba(0, 0, 0, 0.2); - --docsearch-logo-color: rgb(255,255,255); + --docsearch-logo-color: rgb(255, 255, 255); --docsearch-muted-color: rgb(127, 132, 151); } /* Search Button */ .DocSearch-SearchButton { - display: flex; - height: 36px; - margin: 0 0 0 16px; - padding: 0 8px; - border: none; - border-radius: 40px; - cursor: pointer; align-items: center; background: var(--docsearch-searchbox-background); + border: none; + border-radius: 40px; color: var(--docsearch-text-color); + color: var(--docsearch-muted-color); + cursor: pointer; + display: flex; font-weight: 500; + height: 36px; + margin: 0 0 0 16px; + padding: 0 8px; user-select: none; - color: var(--docsearch-muted-color); } .DocSearch-SearchButton:hover, .DocSearch-SearchButton:active, .DocSearch-SearchButton:focus { - outline: none; - color: var(--docsearch-text-color); background: var(--docsearch-searchbox-focus-background); box-shadow: var(--docsearch-searchbox-shadow); + color: var(--docsearch-text-color); + outline: none; } .DocSearch-Search-Icon { @@ -110,24 +109,24 @@ html[data-theme='dark'] { } .DocSearch-SearchButton-Placeholder { - padding: 0 12px 0 6px; font-size: 1rem; + padding: 0 12px 0 6px; } .DocSearch-SearchButton-Key { - display: flex; align-items: center; - justify-content: center; - width: 20px; + background: var(--docsearch-key-gradient); + border-radius: 3px; + box-shadow: var(--docsearch-key-shadow); + color: var(--docsearch-muted-color); + display: flex; height: 18px; + justify-content: center; margin-right: 0.4em; padding-bottom: 2px; - border-radius: 3px; position: relative; top: -1px; - background: var(--docsearch-key-gradient); - box-shadow: var(--docsearch-key-shadow); - color: var(--docsearch-muted-color); + width: 20px; } /* Body modifier */ @@ -148,13 +147,13 @@ html[data-theme='dark'] { } .DocSearch-Container { - z-index: var(--ifm-z-index-fixed); + background-color: var(--docsearch-container-background); height: 100vh; - width: 100vw; - position: fixed; left: 0; + position: fixed; top: 0; - background-color: var(--docsearch-container-background); + width: 100vw; + z-index: var(--ifm-z-index-fixed); } .DocSearch-Container a { @@ -173,13 +172,13 @@ html[data-theme='dark'] { } .DocSearch-Modal { - position: relative; - flex-direction: column; - max-width: var(--docsearch-modal-width); - margin: 60px auto auto auto; - border-radius: 6px; background: var(--docsearch-modal-background); + border-radius: 6px; box-shadow: var(--docsearch-modal-shadow); + flex-direction: column; + margin: 60px auto auto auto; + max-width: var(--docsearch-modal-width); + position: relative; } /* Modal Searchbox */ @@ -190,29 +189,29 @@ html[data-theme='dark'] { } .DocSearch-Form { - display: flex; - width: 100%; - position: relative; - height: var(--docsearch-searchbox-height); - padding: 0 var(--docsearch-spacing); align-items: center; - border-radius: 4px; background: var(--docsearch-searchbox-focus-background); + border-radius: 4px; box-shadow: var(--docsearch-searchbox-shadow); + display: flex; + height: var(--docsearch-searchbox-height); + padding: 0 var(--docsearch-spacing); + position: relative; + width: 100%; } .DocSearch-Input { - height: 100%; + appearance: none; + background: transparent; + border: none; + color: var(--docsearch-text-color); flex: 1; - width: 80%; - padding-left: 8px; font: inherit; font-size: 1.2em; - appearance: none; - border: none; + height: 100%; outline: none; - background: transparent; - color: var(--docsearch-text-color); + padding-left: 8px; + width: 80%; } .DocSearch-Input::placeholder { @@ -236,9 +235,9 @@ html[data-theme='dark'] { .DocSearch-Container--Stalled .DocSearch-LoadingIndicator, .DocSearch-MagnifierLabel, .DocSearch-Reset { + align-items: center; color: var(--docsearch-highlight-color); display: flex; - align-items: center; justify-content: center; } @@ -248,15 +247,15 @@ html[data-theme='dark'] { } .DocSearch-Reset { + animation: fade-in 0.1s ease-in forwards; appearance: none; - right: 0; + background: none; border: none; border-radius: 50%; - background: none; + color: var(--docsearch-icon-color); cursor: pointer; + right: 0; stroke-width: var(--docsearch-icon-stroke-width); - color: var(--docsearch-icon-color); - animation: fade-in 0.1s ease-in forwards; } .DocSearch-Reset[hidden] { @@ -268,11 +267,11 @@ html[data-theme='dark'] { } .DocSearch-Reset { - color: inherit; border: none; - padding: 2px; - cursor: pointer; border-radius: 50%; + color: inherit; + cursor: pointer; + padding: 2px; } .DocSearch-Reset:hover { @@ -281,8 +280,8 @@ html[data-theme='dark'] { .DocSearch-LoadingIndicator svg, .DocSearch-MagnifierLabel svg { - width: 24px; height: 24px; + width: 24px; } .DocSearch-Cancel { @@ -296,10 +295,11 @@ html[data-theme='dark'] { var(--docsearch-modal-height) - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height) ); - padding: 0 var(--docsearch-spacing); overflow-y: overlay; + padding: 0 var(--docsearch-spacing); + scrollbar-color: var(--docsearch-muted-color) + var(--docsearch-modal-background); scrollbar-width: thin; - scrollbar-color: var(--docsearch-muted-color) var(--docsearch-modal-background); } .DocSearch-Dropdown::-webkit-scrollbar { @@ -312,40 +312,40 @@ html[data-theme='dark'] { .DocSearch-Dropdown::-webkit-scrollbar-thumb { background-color: var(--docsearch-muted-color); - border-radius: 20px; border: 3px solid var(--docsearch-modal-background); + border-radius: 20px; } .DocSearch-Dropdown ul { + list-style: none; margin: 0; padding: 0; - list-style: none; } /* Modal Footer */ .DocSearch-Footer { - position: relative; + align-items: center; + background: var(--docsearch-footer-background); + border-radius: 0 0 8px 8px; + box-shadow: var(--docsearch-footer-shadow); display: flex; - width: 100%; - height: var(--docsearch-footer-height); - padding: 0 var(--docsearch-spacing); - z-index: 300; flex-direction: row-reverse; flex-shrink: 0; + height: var(--docsearch-footer-height); justify-content: space-between; - align-items: center; - border-radius: 0 0 8px 8px; - background: var(--docsearch-footer-background); - box-shadow: var(--docsearch-footer-shadow); + padding: 0 var(--docsearch-spacing); + position: relative; user-select: none; + width: 100%; + z-index: 300; } .DocSearch-Commands { display: flex; + list-style: none; margin: 0; padding: 0; - list-style: none; } .DocSearch-Commands li:not(:last-of-type) { @@ -353,26 +353,26 @@ html[data-theme='dark'] { } .DocSearch-Commands { - display: flex; color: var(--docsearch-muted-color); + display: flex; } .DocSearch-Commands li { - display: flex; align-items: center; + display: flex; } .DocSearch-Commands-Key { + align-items: center; + background: var(--docsearch-key-gradient); + border-radius: 2px; + box-shadow: var(--docsearch-key-shadow); display: flex; - width: 20px; height: 18px; + justify-content: center; margin-right: 0.4em; padding-bottom: 2px; - align-items: center; - justify-content: center; - border-radius: 2px; - background: var(--docsearch-key-gradient); - box-shadow: var(--docsearch-key-shadow); + width: 20px; } .DocSearch-Logo a { @@ -380,21 +380,21 @@ html[data-theme='dark'] { } .DocSearch-Logo svg { - margin-left: 8px; color: var(--docsearch-logo-color); + margin-left: 8px; } .DocSearch-Label { + color: var(--docsearch-muted-color); font-size: 0.75em; line-height: 1.6em; - color: var(--docsearch-muted-color); } .DocSearch-Help { - font-size: 0.9em; color: var(--docsearch-muted-color); - user-select: none; + font-size: 0.9em; margin: 0; + user-select: none; } .DocSearch-Title { @@ -413,65 +413,66 @@ html[data-theme='dark'] { } .DocSearch-HitsFooter { - margin-bottom: var(--docsearch-spacing); - padding: var(--docsearch-spacing); color: var(--docsearch-muted-color); display: flex; + font-size: 0.85em; justify-content: center; + margin-bottom: var(--docsearch-spacing); + padding: var(--docsearch-spacing); } .DocSearch-HitsFooter a { - color: inherit; border-bottom: 1px solid; + color: inherit; } .DocSearch-Hit { - display: flex; - position: relative; border-radius: 4px; + display: flex; padding-bottom: 4px; + position: relative; } .DocSearch-Hit--deleting { - transition: all 250ms linear; opacity: 0; + transition: all 250ms linear; } .DocSearch-Hit--favoriting { - transition: all 250ms linear; transform: scale(0); - transition-delay: 250ms; transform-origin: top center; + transition: all 250ms linear; + transition-delay: 250ms; } .DocSearch-Hit a { - display: block; - border-radius: 4px; - width: 100%; - padding-left: var(--docsearch-spacing); background: var(--docsearch-hit-background); + border-radius: 4px; box-shadow: var(--docsearch-hit-shadow); + display: block; + padding-left: var(--docsearch-spacing); + width: 100%; } .DocSearch-Hit-source { + background: var(--docsearch-modal-background); + color: var(--docsearch-highlight-color); + font-size: 0.85em; + font-weight: 600; + line-height: 32px; + margin: 0 -4px; + padding: 8px 4px 0; position: sticky; top: 0; z-index: 10; - margin: 0 -4px; - padding: 8px 4px 0; - line-height: 32px; - font-size: 0.85em; - font-weight: 600; - color: var(--docsearch-highlight-color); - background: var(--docsearch-modal-background); } .DocSearch-Hit-Tree { - width: 24px; - height: var(--docsearch-hit-height); color: var(--docsearch-muted-color); + height: var(--docsearch-hit-height); opacity: 0.5; stroke-width: var(--docsearch-icon-stroke-width); + width: 24px; } .DocSearch-Hit[aria-selected='true'] a { @@ -493,12 +494,12 @@ html[data-theme='dark'] { } .DocSearch-Hit-Container { + align-items: center; + color: var(--docsearch-hit-color); display: flex; + flex-direction: row; height: var(--docsearch-hit-height); padding: 0 var(--docsearch-spacing) 0 0; - flex-direction: row; - align-items: center; - color: var(--docsearch-hit-color); } .DocSearch-Hit-icon, @@ -513,16 +514,16 @@ html[data-theme='dark'] { } .DocSearch-Hit-action { + align-items: center; + display: flex; height: 22px; width: 22px; - display: flex; - align-items: center; } .DocSearch-Hit-action svg { - width: 18px; - height: 18px; display: block; + height: 18px; + width: 18px; } .DocSearch-Hit-action + .DocSearch-Hit-action { @@ -532,11 +533,11 @@ html[data-theme='dark'] { .DocSearch-Hit-action-button { appearance: none; background: none; - color: inherit; border: none; - padding: 2px; - cursor: pointer; border-radius: 50%; + color: inherit; + cursor: pointer; + padding: 2px; } svg.DocSearch-Hit-Select-Icon { @@ -547,8 +548,8 @@ svg.DocSearch-Hit-Select-Icon { } .DocSearch-Hit-action-button:hover { - transition: background-color 0.1s ease-in; background: rgba(0, 0, 0, 0.2); + transition: background-color 0.1s ease-in; } .DocSearch-Hit-action-button:hover path { @@ -556,18 +557,18 @@ svg.DocSearch-Hit-Select-Icon { } .DocSearch-Hit-content-wrapper { - position: relative; display: flex; - width: 80%; - margin: 0 8px; - line-height: 1.2em; flex: 1 1 auto; + flex-direction: column; font-weight: 500; + justify-content: center; + line-height: 1.2em; + margin: 0 8px; overflow-x: hidden; - white-space: nowrap; + position: relative; text-overflow: ellipsis; - justify-content: center; - flex-direction: column; + white-space: nowrap; + width: 80%; } .DocSearch-Hit-title { @@ -575,8 +576,8 @@ svg.DocSearch-Hit-Select-Icon { } .DocSearch-Hit-path { - font-size: 0.75em; color: var(--docsearch-muted-color); + font-size: 0.75em; } /* No Results - Start Screen - Error Screen */ @@ -584,11 +585,11 @@ svg.DocSearch-Hit-Select-Icon { .DocSearch-NoResults, .DocSearch-StartScreen, .DocSearch-ErrorScreen { - width: 80%; + font-size: 0.9em; margin: 0 auto; - text-align: center; padding: 36px 0; - font-size: 0.9em; + text-align: center; + width: 80%; } .DocSearch-Screen-Icon { @@ -597,37 +598,37 @@ svg.DocSearch-Hit-Select-Icon { } .DocSearch-NoResults-Prefill-List { - text-align: left; - padding-bottom: 24px; display: inline-block; + padding-bottom: 24px; + text-align: left; } .DocSearch-NoResults-Prefill-List ul { - padding: 8px 0 0; display: inline-block; + padding: 8px 0 0; } .DocSearch-NoResults-Prefill-List li { - list-style-type: '» '; list-style-position: inside; + list-style-type: '» '; } .DocSearch-Prefill { appearance: none; - cursor: pointer; + background: none; border: none; - display: inline-block; border-radius: 1em; + color: var(--docsearch-highlight-color); + cursor: pointer; + display: inline-block; font-size: 1em; font-weight: 700; - background: none; - color: var(--docsearch-highlight-color); padding: 0; } .DocSearch-Prefill:hover { - text-decoration: underline; outline: none; + text-decoration: underline; } /* Responsive */ @@ -646,7 +647,7 @@ svg.DocSearch-Hit-Select-Icon { display: none; } - .DocSearch-SearchButton-Placeholder{ + .DocSearch-SearchButton-Placeholder { display: none; } @@ -661,42 +662,42 @@ svg.DocSearch-Hit-Select-Icon { .DocSearch-Footer { border-radius: 0; - position: absolute; bottom: 0; + position: absolute; } .DocSearch-Hit-content-wrapper { - position: relative; display: flex; + position: relative; width: 80%; } .DocSearch-Modal { border-radius: 0; box-shadow: none; + height: -webkit-fill-available; margin: 0; - width: 100%; max-width: 100%; - height: -webkit-fill-available; + width: 100%; } .DocSearch-Cancel { - display: inline-block; - white-space: nowrap; - overflow: hidden; - margin-left: var(--docsearch-spacing); - padding: 0; appearance: none; + background: none; border: 0; + color: var(--docsearch-highlight-color); cursor: pointer; - background: none; + display: inline-block; flex: none; font: inherit; font-size: 1em; font-weight: 500; - color: var(--docsearch-highlight-color); + margin-left: var(--docsearch-spacing); outline: none; + overflow: hidden; + padding: 0; user-select: none; + white-space: nowrap; } .DocSearch-Commands {