mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-27 19:25:05 +08:00
* feat(scaleable): add scaleable props to each component * chore(scaleable): update the exported type * feat: apply scaleable to components chore: remove with-default test: improve testcase for scaleable chore: resolve test warning ci: upgrade nodejs to latest lts docs: fix type error in document site * docs: update documents to be compatible with scaleable chore: fix build errors * chore: remove all size-related attributes docs: improve guide document * docs: add scaleable documentation test: update snapshots chore: remove unused * feat: add scaleable to grid components * docs: improve docs * test: update snapshots * fix(grid): fix basic component props
59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
import React from 'react'
|
|
import useTheme from '../use-theme'
|
|
import useScaleable, { withScaleable } from '../use-scaleable'
|
|
|
|
interface Props {
|
|
className?: string
|
|
}
|
|
|
|
const defaultProps = {
|
|
className: '',
|
|
}
|
|
|
|
export type AutoCompleteSearchProps = Props & React.HTMLAttributes<any>
|
|
|
|
const AutoCompleteSearchComponent: React.FC<
|
|
React.PropsWithChildren<AutoCompleteSearchProps>
|
|
> = ({
|
|
children,
|
|
className,
|
|
}: React.PropsWithChildren<AutoCompleteSearchProps> & typeof defaultProps) => {
|
|
const theme = useTheme()
|
|
const { SCALES } = useScaleable()
|
|
|
|
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;
|
|
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};
|
|
font-size: ${SCALES.font(0.875)};
|
|
width: ${SCALES.width(1, 'auto')};
|
|
height: ${SCALES.height(1, 'auto')};
|
|
padding: ${SCALES.pt(0.875)} ${SCALES.pr(0.875)} ${SCALES.pb(0.875)}
|
|
${SCALES.pl(0.875)};
|
|
margin: ${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)};
|
|
}
|
|
`}</style>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
AutoCompleteSearchComponent.defaultProps = defaultProps
|
|
AutoCompleteSearchComponent.displayName = 'GeistAutoCompleteSearch'
|
|
const AutoCompleteSearch = withScaleable(AutoCompleteSearchComponent)
|
|
|
|
export default AutoCompleteSearch
|