mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-28 20:25:29 +08:00
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import React from 'react'
|
|
import withDefaults from '../utils/with-defaults'
|
|
import useTheme from '../styles/use-theme'
|
|
|
|
interface Props {
|
|
className?: string
|
|
}
|
|
|
|
const defaultProps = {
|
|
className: '',
|
|
}
|
|
|
|
export type AutoCompleteSearchProps = Props & typeof defaultProps & React.HTMLAttributes<any>
|
|
|
|
const AutoCompleteSearch: React.FC<React.PropsWithChildren<AutoCompleteSearchProps>> = ({
|
|
children, className,
|
|
}) => {
|
|
const theme = useTheme()
|
|
|
|
return (
|
|
<div className={className}>
|
|
{children}
|
|
<style jsx>{`
|
|
div {
|
|
display: flex;
|
|
justify-content: center;
|
|
text-align: center;
|
|
align-items: center;
|
|
font-weight: normal;
|
|
white-space: pre;
|
|
font-size: .875rem;
|
|
padding: ${theme.layout.gapHalf};
|
|
line-height: 1;
|
|
background-color: ${theme.palette.background};
|
|
color: ${theme.palette.accents_5};
|
|
user-select: none;
|
|
border: 0;
|
|
border-radius: ${theme.layout.radius};
|
|
}
|
|
`}</style>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default withDefaults(AutoCompleteSearch, defaultProps)
|