Skip to content

Commit

Permalink
[FE] 공통 컴포넌트 구현 (#19)
Browse files Browse the repository at this point in the history
* feat, refactor: 공통 컴포넌트 개발 및 리팩토링

* feat: 공통 컴포넌트 개발

* chore: 디렉토리 구조 변경
  • Loading branch information
saejinpark authored Jul 18, 2023
1 parent 70ed720 commit 3052149
Show file tree
Hide file tree
Showing 41 changed files with 1,017 additions and 565 deletions.
8 changes: 4 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"styled-components": "^6.0.3"
},
"devDependencies": {
"@types/react": "^18.2.14",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.6",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
Expand Down
3 changes: 0 additions & 3 deletions frontend/public/close-danger.svg

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/public/close.svg

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/public/edit.svg

This file was deleted.

4 changes: 0 additions & 4 deletions frontend/public/log.svg

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/public/plus.svg

This file was deleted.

89 changes: 22 additions & 67 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,72 +1,27 @@
import { useState, useRef } from "react";
import styled, { ThemeProvider } from "styled-components";
import Board from "./components/Board";
import HistoryBtn from "./components/HistoryBtn";
import Logo from "./components/Logo";
import Modal from "./components/Modal";
import Header from "./components/landmark/Header";
import Main from "./components/landmark/Main";
import CommonStyle from "./styles/CommonStyle";
import { theme } from "./theme";
import { TTheme } from "./types/theme";

export default function App() {
const [isUserLogOpened, setIsUserLogOpened] = useState<boolean>(false);
const [message, setMessage] = useState<string>("");
const callbackTemp = useRef<() => void | undefined>();

function clearMessage() {
setMessage("");
}

function dummyAction() {
clearMessage();
if (callbackTemp.current) {
callbackTemp.current();
}
}

function openConfirmModal(content: string, callback: () => void) {
setMessage(content);
callbackTemp.current = callback;
}

function toggleActiveUserLog() {
setIsUserLogOpened((bool) => !bool);
import { useState } from "react";
import Header from "./components/Header";
import Main from "./components/main/Main";
import Alert from "./components/common/Alert";
import Container from "./styles/Container";
import Aside from "./components/aside/Aside";

const App: React.FC = () => {
const [isHistoryOpen, setIsHistoryOpen] = useState<boolean>(false);

function toggleHistory() {
setIsHistoryOpen((bool) => !bool);
}

return (
<ThemeProvider theme={theme}>
<AppStyledDiv>
<CommonStyle />
<Header>
<Logo />
<HistoryBtn {...{ toggleActiveUserLog }} />
</Header>
<Container>
<Main>
<Board handleDeleteButtonClick={openConfirmModal} />
</Main>
{/* <Aside>
<UserActionLogList />
</Aside> */}
</Container>
<Modal message={message} action={dummyAction} />
</AppStyledDiv>{" "}
</ThemeProvider>
<>
<Header />
<Container>
<Main />
{/* <Aside /> */}
</Container>
<Alert />
</>
);
}

const AppStyledDiv = styled.div<{ theme: TTheme }>`
position: relative;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
background-color: ${(props) => props.theme.color.surface.alt};
`;
};

const Container = styled.div`
display: flex;
padding: calc(2.29rem - 4px) calc(5.8rem - 4px);
`;
export default App;
Loading

0 comments on commit 3052149

Please sign in to comment.