Files
react/components/page/page-footer.tsx
witt 5cfa581728 refactor(use-theme): move use-theme to the top directory (#397)
* refactor(use-theme): move use-theme to the top directory

* chore(jest): ignore use-theme of forwarding
2020-10-16 10:45:28 +08:00

34 lines
761 B
TypeScript

import React from 'react'
import useTheme from '../use-theme'
import withDefaults from '../utils/with-defaults'
interface Props {
className?: string
}
const defaultProps = {
className: '',
}
type NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>
export type PageHeaderProps = Props & typeof defaultProps & NativeAttrs
const PageFooter: React.FC<React.PropsWithChildren<PageHeaderProps>> = ({ children, ...props }) => {
const theme = useTheme()
return (
<footer {...props}>
{children}
<style jsx>{`
footer {
width: calc(100% - ${theme.layout.gap} * 2);
position: absolute;
bottom: 0;
}
`}</style>
</footer>
)
}
export default withDefaults(PageFooter, defaultProps)