Extract search styling to .css
This commit is contained in:
parent
9d9735a252
commit
791309031c
@ -1,45 +1,11 @@
|
|||||||
import { Flex, FlexProps } from '@chakra-ui/react'
|
|
||||||
import { DocSearch } from '@docsearch/react';
|
import { DocSearch } from '@docsearch/react';
|
||||||
|
|
||||||
import '@docsearch/css';
|
import '@docsearch/css';
|
||||||
|
|
||||||
export const Search: React.FC<FlexProps> = (props) => (
|
export const Search: React.FC = () => (
|
||||||
<Flex
|
<DocSearch
|
||||||
css={`
|
appId="R2IYF7ETH7"
|
||||||
svg.DocSearch-Search-Icon path {
|
apiKey="599cec31baffa4868cae4e79f180729b"
|
||||||
color: var(--chakra-colors-primary);
|
indexName="docsearch"
|
||||||
}
|
/>
|
||||||
.DocSearch-Button {
|
|
||||||
border-radius: 0;
|
|
||||||
height: 100%;
|
|
||||||
background: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 1rem;
|
|
||||||
width: 200px;
|
|
||||||
}
|
|
||||||
.DocSearch-Button:hover {
|
|
||||||
background: none;
|
|
||||||
}
|
|
||||||
.DocSearch-Button-Container {
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
}
|
|
||||||
.DocSearch-Button-Keys {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.DocSearch-Button-Placeholder {
|
|
||||||
text-transform: lowercase;
|
|
||||||
font-style: italic;
|
|
||||||
color: var(--chakra-colors-primary);
|
|
||||||
font-weight: 400;
|
|
||||||
width: 100%;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<DocSearch
|
|
||||||
appId="R2IYF7ETH7"
|
|
||||||
apiKey="599cec31baffa4868cae4e79f180729b"
|
|
||||||
indexName="docsearch" />
|
|
||||||
</Flex>
|
|
||||||
)
|
)
|
||||||
|
@ -10,6 +10,9 @@ import theme from '../theme';
|
|||||||
import { MDXProvider } from '@mdx-js/react';
|
import { MDXProvider } from '@mdx-js/react';
|
||||||
import MDXComponents from '../components/';
|
import MDXComponents from '../components/';
|
||||||
|
|
||||||
|
// Algolia search css styling
|
||||||
|
import '../theme/search.css';
|
||||||
|
|
||||||
export default function App({ Component, pageProps }: AppProps) {
|
export default function App({ Component, pageProps }: AppProps) {
|
||||||
return (
|
return (
|
||||||
<ChakraProvider theme={theme}>
|
<ChakraProvider theme={theme}>
|
||||||
|
35
src/theme/search.css
Normal file
35
src/theme/search.css
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/* Search field on desktop nav bar */
|
||||||
|
.DocSearch-Button {
|
||||||
|
border-radius: 0;
|
||||||
|
height: 100%;
|
||||||
|
background: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 1rem;
|
||||||
|
width: 200px;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
.DocSearch-Button:hover {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
.DocSearch-Button-Container {
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.DocSearch-Button-Keys kbd {
|
||||||
|
background: none;
|
||||||
|
border: 1px solid var(--chakra-colors-primary);
|
||||||
|
color: var(--chakra-colors-primary);
|
||||||
|
box-shadow: none;
|
||||||
|
padding: 0.125rem;
|
||||||
|
}
|
||||||
|
.DocSearch-Button-Placeholder {
|
||||||
|
text-align: start;
|
||||||
|
text-transform: lowercase;
|
||||||
|
font-style: italic;
|
||||||
|
color: var(--chakra-colors-primary);
|
||||||
|
font-weight: 400;
|
||||||
|
width: 100%;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user