Skip to content
Snippets Groups Projects
Commit 5529aa5c authored by 김영진's avatar 김영진
Browse files

feat: mpa,spa1,spa2,spa3

parent acf16727
No related branches found
No related tags found
No related merge requests found
Showing
with 241 additions and 0 deletions
File added
test/mpa/Asset/menu.png

161 B

#header {
width: 100%;
height: 80px;
background-color: #045d8b;
display: flex;
justify-content: space-around;
align-items: center;
color: #ffffff;
}
#header div {
cursor: pointer;
}
// const headerContainer = document.querySelector("#header");
// headerContainer.innerHTML = `
// <div class="Header__MenuIcon__Container">
// <img src="../Asset/menu.png" />
// </div>
// <div class="Header__Title__Container" >
// <a href="../Page/write.html" >
// Ajou Memo
// </a>
// </div>
// <div class="Header__Login__Container">
// Login
// </div>
// `;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="../CSS/Main.css" />
</head>
<body>
<div id="header">
<div class="Header__MenuIcon__Container">
<img src="../Asset/menu.png" />
</div>
<div class="Header__Title__Container">
<a href="../Page/write.html"> Ajou Memo </a>
</div>
<div class="Header__Login__Container">Login</div>
</div>
<div id="body"></div>
<div id="footer"></div>
<script type="module" src="../JS/Main.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div>ㅇㅕ기는 글쓰기 페이지</div>
</body>
</html>
test/spa1/public/Asset/menu.png

161 B

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="../src/Main/Main.css" />
</head>
<body>
<div id="root"></div>
<script type="module" src="../src/index.js"></script>
</body>
</html>
import { WritePage } from "./Write/write.js";
export const Header = () => {
const root = document.querySelector("#root");
root.innerHTML = `
<div id="header">
<div class="Header__MenuIcon__Container">
<img src="../public/Asset/menu.png" />
</div>
<div class="Header__Title__Container" >
Ajou Memo
</div>
<div class="Header__Login__Container">
Login
</div>
</div>
`;
};
export const addEvent = () => {
const titleContainer = document.querySelector(".Header__Title__Container");
titleContainer.addEventListener("click", () => {
WritePage();
history.pushState(null, null, "/write");
});
};
#header {
width: 100%;
height: 80px;
background-color: #045d8b;
display: flex;
justify-content: space-around;
align-items: center;
color: #ffffff;
}
#header div {
cursor: pointer;
}
export const MainPage = () => {
makeBodyTitle();
makeBodyContainer();
makeFooter();
// const root = document.querySelector("#root");
// const MainBody = document.createElement("div");
// MainBody.className = "body";
// MainBody.innerHTML = `<div>메인페이지</div>`;
// root.appendChild(MainBody);
};
const makeBodyTitle = () => {};
const makeBodyContainer = () => {};
const makeFooter = () => {};
export const WritePage = () => {
const body = document.querySelector(".body");
body.innerHTML = "<div>여기는 글쓰기 페이지 입니다.</div>";
};
import { MainPage } from "./Main/main.js";
import { Header, addEvent } from "./Header.js";
const init = () => {
Header();
MainPage();
addEvent();
};
init();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="../src/index.js"></script>
</body>
</html>
import Component from "../common/Component.js";
export default class Bye extends Component {
constructor(...args) {
super(...args);
}
template() {
return `bye`;
}
}
export default class Component {
$target;
$state;
constructor(target, state) {
this.$target = target;
this.$state = state;
this.render();
}
template() {
return `<div>hi</div>`;
}
render() {
this.$target.innerHTML = this.template();
}
}
import Component from "./common/Component.js";
import Bye from "./Component/bye.js";
const $ = (selector) => document.querySelector(selector);
const create = (selector) => document.createElement(selector);
const root = $("#root");
const app = new Component(root, null);
const temp = create("div");
temp.className = "Temp";
root.appendChild(temp);
const bye = new Bye(temp, null);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="../src/index.js"></script>
</body>
</html>
export default function Hi(el) {
const target = el;
const template = () => {
return `
<div>header</div>
<div>body</div>
<div>footer</div>
`;
};
const render = () => {
target.innerHTML = template();
addEvent();
};
const addEvent = () => {};
return render;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment