ota-meshi / vuepress-plugin-full-text-search2

VuePress v2 plugin that adds full-text search box.
MIT License
34 stars 4 forks source link

How can I customize the style of this plugin's search area ? #30

Open listky opened 1 year ago

listky commented 1 year ago

I want the width of this area could be fixed instead of being flex with those search results, by the way, this is a wonderful plugin for vuepress2 ,hope to receive your reply

image image

ota-meshi commented 1 year ago

Can't you customize using CSS? If you can't do it with CSS, you may not be able to customize it.

listky commented 1 year ago

I will try it by using CSS only if I know where it is defined, tks please

RaniAgus commented 1 year ago

I found some SCSS variables (that could be overriden in Styles File) here: https://github.com/ota-meshi/vuepress-plugin-full-text-search2/blob/e6ccfb5027f907b87c6a228e72c21f89ca26f0bd/src/client/SearchBox.vue#L154-L166

Sadly, page titles' background color doesn't seem to be customizable because it's hardcoded: https://github.com/ota-meshi/vuepress-plugin-full-text-search2/blob/e6ccfb5027f907b87c6a228e72c21f89ca26f0bd/src/client/SearchBox.vue#L235

rxliuli commented 1 year ago

--search-result-width: 20rem;

This variable doesn't seem to be used?

image

ota-meshi commented 1 year ago

Welcome PRs to fix it.

twgh commented 1 year ago

docs\.vuepress\styles\index.scss里添加css代码, 我目前用的是这样的:

:root {
  --search-input-width: 8rem !important;
  --search-result-width: 100% !important;
}

.suggestions {
  position: fixed !important;
  left: 18vw !important;
  top: calc(var(--navbar-line-height) + 7px) !important;
  max-width: 100% !important;
}