diff options
| author | 2023-10-07 06:48:07 +0800 | |
|---|---|---|
| committer | 2023-10-07 06:48:07 +0800 | |
| commit | 991fd7a6d67ee017c57beaaa21fc31c4bee7944d (patch) | |
| tree | e895202203fcaa50b0052f60ef6fc7d6d2928cf9 /src/overrides/assets/stylesheets/custom/layout/_iconsearch.scss | |
| parent | d62900046bb6f754a8e6e7e670a66a90134055d9 (diff) | |
| download | infini-991fd7a6d67ee017c57beaaa21fc31c4bee7944d.tar.gz infini-991fd7a6d67ee017c57beaaa21fc31c4bee7944d.zip | |
feat(version): versions
Diffstat (limited to 'src/overrides/assets/stylesheets/custom/layout/_iconsearch.scss')
| -rw-r--r-- | src/overrides/assets/stylesheets/custom/layout/_iconsearch.scss | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/src/overrides/assets/stylesheets/custom/layout/_iconsearch.scss b/src/overrides/assets/stylesheets/custom/layout/_iconsearch.scss new file mode 100644 index 00000000..651c4135 --- /dev/null +++ b/src/overrides/assets/stylesheets/custom/layout/_iconsearch.scss @@ -0,0 +1,136 @@ +//// +/// Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com> +/// +/// Permission is hereby granted, free of charge, to any person obtaining a +/// copy of this software and associated documentation files (the "Software"), +/// to deal in the Software without restriction, including without limitation +/// the rights to use, copy, modify, merge, publish, distribute, sublicense, +/// and/or sell copies of the Software, and to permit persons to whom the +/// Software is furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +/// DEALINGS +//// + +// ---------------------------------------------------------------------------- +// Rules +// ---------------------------------------------------------------------------- + +// Scoped in typesetted content to match specificity of regular content +.md-typeset { + + // Icon search + .mdx-iconsearch { + position: relative; + background-color: var(--md-default-bg-color); + border-radius: px2rem(2px); + box-shadow: var(--md-shadow-z1); + transition: box-shadow 125ms; + + // Icon search on focus/hover + &:is(:focus-within, :hover) { + box-shadow: var(--md-shadow-z2); + } + + // Icon search input + .md-input { + background: var(--md-default-bg-color); + box-shadow: none; + + // Slate theme, i.e. dark mode + [data-md-color-scheme="slate"] & { + background: var(--md-code-bg-color); + } + } + } + + // Icon search result + .mdx-iconsearch-result { + max-height: 50vh; + overflow-y: auto; + // Hack: promote to own layer to reduce jitter + backface-visibility: hidden; + touch-action: pan-y; + scrollbar-width: thin; + scrollbar-color: var(--md-default-fg-color--lighter) transparent; + + // Icon search result inside tooltip + .md-tooltip & { + max-height: px2rem(205px); + } + + // Webkit scrollbar + &::-webkit-scrollbar { + width: px2rem(4px); + height: px2rem(4px); + } + + // Webkit scrollbar thumb + &::-webkit-scrollbar-thumb { + background-color: var(--md-default-fg-color--lighter); + + // Webkit scrollbar thumb on hover + &:hover { + background-color: var(--md-accent-fg-color); + } + } + + // Icon search result metadata + &__meta { + position: absolute; + top: px2rem(8px); + right: px2rem(12px); + font-size: px2rem(12.8px); + color: var(--md-default-fg-color--lighter); + } + + // Icon search result list + &__list { + padding: 0; + margin: 0; + // Hack: necessary because of increased specificity due to the PostCSS + // plugin which prefixes this with `[dir=...]` selectors. + margin-inline-start: 0; + list-style: none; + } + + // Icon search result item + &__item { + padding: px2rem(4px) px2rem(12px); + margin: 0; + // Hack: necessary because of increased specificity due to the PostCSS + // plugin which prefixes this with `[dir=...]` selectors. + margin-inline-start: 0; + border-bottom: px2rem(1px) solid var(--md-default-fg-color--lightest); + + // Omit border on last child + &:last-child { + border-bottom: none; + } + + // Item content + > * { + margin-right: px2rem(12px); + } + + // Set icon dimensions to fit + img { + width: px2rem(18px); + height: px2rem(18px); + + // Slate theme, i.e. dark mode + [data-md-color-scheme="slate"] &[src*="squidfunk"] { + filter: invert(1); /* stylelint-disable-line */ + } + } + } + } +} |
