Skip to content

Commit

Permalink
feat: 모달 컴포넌트 추가,캘린더 input 참조용
Browse files Browse the repository at this point in the history
  • Loading branch information
PelicanStd committed Jul 25, 2023
1 parent 081fab8 commit 449e37a
Show file tree
Hide file tree
Showing 13 changed files with 286 additions and 8 deletions.
1 change: 0 additions & 1 deletion index2.html → index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<<<<<<< HEAD
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down
102 changes: 102 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@tanstack/react-query": "^4.32.0",
"axios": "^1.4.0",
"react": "^18.2.0",
"react-date-range": "^1.4.0",
"react-dom": "^18.2.0",
"react-icons": "^4.10.1",
"scss": "^0.2.4",
Expand All @@ -22,6 +23,7 @@
"devDependencies": {
"@types/node": "^20.4.4",
"@types/react": "^18.0.37",
"@types/react-date-range": "^1.4.4",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
Expand Down
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Main from "./pages/Main/main.tsx";


function App() {

return (
<>
<h1>라우터 필요시 생성</h1>
<Main />
</>
)
}
Expand Down
32 changes: 32 additions & 0 deletions src/Components/Calendar-input/Calendar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { useState } from 'react';
import { DateRange, Range } from 'react-date-range';
import 'react-date-range/dist/styles.css';
import 'react-date-range/dist/theme/default.css';

export default function MyDateRangePicker() {
const [state, setState] = useState<Range[]>([
{
startDate: new Date(),
endDate: undefined,
key: 'selection'
}
]);

// 선택한 날짜 범위를 받아 옵니다.
console.log(state[0].startDate);
console.log(state[0].endDate);

const handleSelect = (ranges: { [key: string]: Range }) => {
setState([ranges['selection']]);
}

return (
<DateRange
editableDateInputs={true}
onChange={handleSelect}
moveRangeOnFirstSelection={false}
ranges={state}
/>
);
}

46 changes: 46 additions & 0 deletions src/Components/Common/Modal/Modal.css

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

1 change: 1 addition & 0 deletions src/Components/Common/Modal/Modal.css.map

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

45 changes: 45 additions & 0 deletions src/Components/Common/Modal/Modal.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.modal-overlay {
position: fixed;
min-width: 100vw;
min-height: 100vh;
top: 0;
left: 0;
z-index: 9999;
overflow: hidden;
//display: flex;
flex-direction: column;
align-items: center;
//justify-content: center;
background-color: rgba(0, 0, 0, 0.375);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.modal-window {
// position: fixed;
margin: auto;
display: flex;
max-width: 100vw;
height: auto;
flex-direction: column;
justify-content: center;
background-color: #fff;
align-items: center;
border-radius: 12px;
overflow: hidden;
padding-bottom: 30px;
}
.modal-close {
bottom: 10px;
width: 164px;
height: 40px;
color: indianred;
font-size: 18px;
transition: 0.1s;
margin: 30px auto 10px;
background-color: var(--primary2);
&:hover {
transform: scale(1.03);
background-color: var(--primary3);
}
}
29 changes: 29 additions & 0 deletions src/Components/Common/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { PropsWithChildren } from "react";

import "./Modal.scss";

interface ModalProps {
visibility: boolean;
toggle: (param: boolean) => void;
}

export default function Modal(props: PropsWithChildren<ModalProps>) {
return (
<div
className="modal-overlay"
style={{ display: props.visibility ? "flex" : "none" }}
>
<div className="modal-window">
{props.children}
<button
className="modal-close"
onClick={() => {
props.toggle(false);
}}
>
닫기
</button>
</div>
</div>
);
}
7 changes: 0 additions & 7 deletions src/Components/Sample/Sample.tsx

This file was deleted.

Empty file removed src/Components/Sample/sample.scss
Empty file.
Loading

0 comments on commit 449e37a

Please sign in to comment.