UNPKG

dumi

Version:

📖 Documentation Generator of React Component

245 lines (212 loc) • 5.08 kB
@import (reference) '../../styles/variables.less'; .@{prefix}-search-bar { position: relative; @media @mobile { // TODO: support search for mobile devices display: none; } &:not(:last-child) { margin-inline-end: 28px; } &-svg { position: absolute; top: 50%; margin-top: 1px; inset-inline-start: 16px; width: 16px; fill: @c-text-note; transform: translateY(-50%); @{dark-selector} & { fill: @c-text-note-dark; } } &-input { width: 280px; height: 40px; padding: 0; padding-inline-start: 40px; padding-inline-end: 12px; color: @c-text; font-size: 14px; border: 1px solid @c-border; border-radius: 20px; box-sizing: border-box; outline: none; transition: all 0.3s; background-color: transparent; @{dark-selector} & { color: @c-text-dark; border-color: @c-border-dark; } &:focus { border-color: fade(@c-primary, 50%); background-color: #fff; box-shadow: 0 0 0 3px fade(@c-primary, 10%); @{dark-selector} & { border-color: fade(@c-primary-dark, 50%); background-color: @c-site-bg-dark; box-shadow: 0 0 0 3px fade(@c-primary-dark, 10%); } } &:focus, &:not(:placeholder-shown) { ~ .@{prefix}-search-shortcut { opacity: 0; } } } .@{prefix}-search-shortcut { position: absolute; top: 50%; inset-inline-end: 11px; display: inline-block; padding: 4px 8px; color: @c-text-note; font-size: 12px; line-height: 1; white-space: nowrap; background-color: fade(#fff, 80%); border-radius: 11px; border: 1px solid @c-border; transform: translateY(-50%); transition: all 0.3s; pointer-events: none; @{dark-selector} & { background-color: fade(#000, 20%); border-color: @c-border-dark; } @media @mobile { display: none; } } .@{prefix}-search-popover { position: absolute; top: 100%; inset-inline-end: 0; display: flex; flex-direction: column; width: 540px; max-height: 460px; margin-top: 18px; background-color: #fff; border-radius: 8px; box-shadow: 0 4px 30px rgba(0, 0, 0, 20%); @{dark-selector} & { background-color: lighten(@c-site-bg-dark, 6%); } &::before { content: ''; position: absolute; bottom: 100%; inset-inline-end: 100px; display: inline-block; width: 0; height: 0; border: 8px solid transparent; border-bottom-color: #fff; @{dark-selector} & { border-bottom-color: lighten(@c-site-bg-dark, 6%); } } > section { flex: 1; min-height: 60px; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; border-radius: inherit; } } .@{prefix}-search-modal { position: fixed; top: 0; inset-inline-start: 0; z-index: 1000; width: 100vw; height: 100vh; display: flex; justify-content: center; &-mask { background-color: rgba(0, 0, 0, 45%); width: 100%; height: 100%; } &-content { position: absolute; top: 60px; background-color: #fff; width: 500px; padding: 12px; box-sizing: border-box; box-shadow: inset 1px 1px 0 0 hsla(0deg, 0%, 100%, 50%), 0 3px 8px 0 #555a64; border-radius: 8px; max-height: calc(100% - 120px); display: flex; flex-direction: column; @{dark-selector} & { background-color: lighten(@c-site-bg-dark, 6%); } } .@{prefix}-search-bar-input { width: 100%; border-radius: 4px; } .@{prefix}-search-result { min-height: 60px; margin-top: 12px; flex: auto; overflow: auto; > dl > dd { margin: 0 auto; } } &-commands { justify-content: flex-start; font-size: 12px; color: @c-text-note; list-style: none; padding: 0; margin: 0; border-top: 1px solid @c-border-light; padding-top: 12px; display: flex; align-items: center; user-select: none; @{dark-selector} & { color: @c-text-note-dark; border-top-color: @c-border-less-dark; } > li { margin-inline-end: 10px; } &-arrow { .@{prefix}-search-modal-shortcut { margin-inline-end: 4px; } } &-text { margin-inline-start: 5px; } } &-shortcut { display: inline-block; padding: 4px 8px; color: @c-text-note; font-size: 12px; line-height: 1; white-space: nowrap; background-color: @c-site-bg; border-radius: 3px; border: 1px solid @c-border; border-bottom-width: 2px; transition: all 0.3s; pointer-events: none; @{dark-selector} & { color: @c-text-note-dark; background-color: @c-site-bg-dark; border-color: @c-border-dark; } } } }