mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
docs: website SearchBar support dark theme (#40652)
This commit is contained in:
parent
8ecb4cdc60
commit
b0ea26bf64
@ -13,6 +13,7 @@ import {
|
||||
PreviewImage,
|
||||
Reset,
|
||||
Responsive,
|
||||
SearchBar,
|
||||
} from './styles';
|
||||
|
||||
const GlobalStyles = () => (
|
||||
@ -30,6 +31,7 @@ const GlobalStyles = () => (
|
||||
<PreviewImage />
|
||||
<ColorStyle />
|
||||
<HeadingAnchor />
|
||||
<SearchBar />
|
||||
</>
|
||||
);
|
||||
|
||||
|
57
.dumi/theme/common/styles/SearchBar.tsx
Normal file
57
.dumi/theme/common/styles/SearchBar.tsx
Normal file
@ -0,0 +1,57 @@
|
||||
import React from 'react';
|
||||
import { css, Global } from '@emotion/react';
|
||||
import useSiteToken from '../../../hooks/useSiteToken';
|
||||
|
||||
const THEME_PREFIX = 'dumi-default-';
|
||||
|
||||
export default () => {
|
||||
const { token } = useSiteToken();
|
||||
|
||||
return (
|
||||
<Global
|
||||
styles={css`
|
||||
html {
|
||||
.${THEME_PREFIX}search-bar {
|
||||
&-input {
|
||||
color: ${token.colorText};
|
||||
background: ${token.colorBgContainer};
|
||||
&:focus {
|
||||
background: ${token.colorBgContainer};
|
||||
}
|
||||
&::placeholder {
|
||||
color: ${token.colorTextPlaceholder} !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.${THEME_PREFIX}search-popover {
|
||||
background-color: ${token.colorBgElevated} !important;
|
||||
&::before {
|
||||
border-bottom-color: ${token.colorBgElevated} !important;
|
||||
}
|
||||
}
|
||||
.${THEME_PREFIX}search-result {
|
||||
dl {
|
||||
dt {
|
||||
background-color: ${token.controlItemBgActive} !important;
|
||||
}
|
||||
dd {
|
||||
a {
|
||||
&:hover {
|
||||
background-color: ${token.controlItemBgHover};
|
||||
h4,
|
||||
p {
|
||||
color: ${token.colorText} !important;
|
||||
}
|
||||
svg {
|
||||
fill: ${token.colorText} !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`}
|
||||
/>
|
||||
);
|
||||
};
|
@ -10,3 +10,4 @@ export { default as BrowserMockup } from './BrowserMockup';
|
||||
export { default as Responsive } from './Responsive';
|
||||
export { default as NProgress } from './NProgress';
|
||||
export { default as PreviewImage } from './PreviewImage';
|
||||
export { default as SearchBar } from './SearchBar';
|
||||
|
Loading…
Reference in New Issue
Block a user