Skip to content

Commit 3e68272

Browse files
authored
Header and footer (#2)
Make header and footer sticky.
1 parent 50b18f2 commit 3e68272

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/components/layout.tsx

+15-7
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ const AppHeader = () => {
4444
fill="horizontal"
4545
pad={{ horizontal: "large", vertical: "none" }}
4646
style={{
47+
position: "absolute",
4748
boxShadow: "rgba(0, 0, 0, 0.1) 0px 1px 2px 0px",
4849
}}
49-
sticky="scrollup"
5050
>
5151
<Box direction="row" align="center" gap="medium">
5252
<Button as={Link} {...{ to: "/" }}>
@@ -87,7 +87,15 @@ const AppHeader = () => {
8787

8888
const AppFooter = () => {
8989
return (
90-
<Footer background="dark-1" pad="medium" justify="between">
90+
<Footer
91+
background="dark-1"
92+
pad="medium"
93+
justify="between"
94+
style={{
95+
position: "sticky",
96+
top: "100vh",
97+
}}
98+
>
9199
<Text>
92100
Copyright by{" "}
93101
<ExternalLink href="https://github.com/ueokande">
@@ -105,11 +113,11 @@ const AppFooter = () => {
105113
export const Layout: React.FC<Props> = ({ children }) => {
106114
return (
107115
<Grommet theme={grommet} full>
108-
<Box>
109-
<AppHeader />
110-
<Main flex>{children}</Main>
111-
<AppFooter />
112-
</Box>
116+
<AppHeader />
117+
<Main margin={{ top: "large" }} fill={false}>
118+
{children}
119+
</Main>
120+
<AppFooter />
113121
</Grommet>
114122
);
115123
};

0 commit comments

Comments
 (0)