Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu 컴포넌트 CSS 수정 #127

Merged
merged 5 commits into from
Dec 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions frontend/src/components/pages/PageComponent/PageComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,28 @@ import { HeaderMenu } from '@components/organisms';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { blockMapState, pageState, staticMenuToggleState } from '@/stores';
import { createBlock } from '@/utils';
import styled from '@emotion/styled';
import { animated, useSpring } from 'react-spring';

const staticMenuAreaCss = () => css`
const staticMenuAreaCss = css`
position: fixed;
z-index: 2;
`;
const staticHeaderAreaCss = (staticMenuToggle: boolean) => css`
const AnimatedStaticHeaderArea = styled(animated.div)`
position: fixed;
right: 0;
left: ${staticMenuToggle ? 240 : 0}px;
width: calc(100% - ${staticMenuToggle ? 240 : 0}px);
background-color: #ffffff;
z-index: 1;
`;
const staticScrollAreaCss = (staticMenuToggle: boolean) => css`
const AnimatedStaticScrollArea = styled(animated.div)`
position: fixed;
top: 45px;
right: 0;
left: ${staticMenuToggle ? 240 : 0}px;
width: calc(100% - ${staticMenuToggle ? 240 : 0}px);
background-color: #ffffff;
height: calc(100% - 45px);
overflow: auto;
`;
const bottomMarginCss = () => css`
const bottomMarginCss = css`
display: inline-block;
width: 100%;
height: calc(100% - 200px);
Expand All @@ -40,6 +39,10 @@ function PageComponent(): JSX.Element {
const staticMenuToggle = useRecoilValue(staticMenuToggleState);
const page = useRecoilValue(pageState);
const setBlockMap = useSetRecoilState(blockMapState);
const staticAreaStyleProps = useSpring({
left: staticMenuToggle ? 240 : 0,
width: `calc(100% - ${staticMenuToggle ? 240 : 0}px)`,
});

const createBlockHandler = async () => {
const { parent, block } = await createBlock({ parentBlockId: page.rootId });
Expand All @@ -53,21 +56,21 @@ function PageComponent(): JSX.Element {

return (
<div>
<div css={staticMenuAreaCss()}>
<div css={staticMenuAreaCss}>
<HeaderMenu />
</div>
<div css={staticHeaderAreaCss(staticMenuToggle)}>
<AnimatedStaticHeaderArea style={staticAreaStyleProps}>
<Header />
</div>
<div css={staticScrollAreaCss(staticMenuToggle)}>
</AnimatedStaticHeaderArea>
<AnimatedStaticScrollArea style={staticAreaStyleProps}>
Comment on lines -59 to +65
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

애니메이션 넘 부드러워용 😌

<Title />
<Editor />
<div
css={bottomMarginCss()}
css={bottomMarginCss}
onClick={createBlockHandler}
onKeyUp={createBlockHandler}
/>
</div>
</AnimatedStaticScrollArea>
</div>
);
}
Expand Down