mirror of
https://github.com/zhigang1992/react.git
synced 2026-03-26 22:42:51 +08:00
fix(page): fix page footer width (#387)
This commit is contained in:
@@ -18,7 +18,7 @@ exports[`PageChild should work with child component 1`] = `
|
||||
}
|
||||
</style></main><footer class=\\"\\">Footer<style>
|
||||
footer {
|
||||
width: 100%;
|
||||
width: calc(100% - 16pt * 2);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React from 'react'
|
||||
import useTheme from '../styles/use-theme'
|
||||
import withDefaults from '../utils/with-defaults'
|
||||
|
||||
interface Props {
|
||||
@@ -13,12 +14,14 @@ 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: 100%;
|
||||
width: calc(100% - ${theme.layout.gap} * 2);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user