From 4698e9acb899094db168a27f06b422b9e5471160 Mon Sep 17 00:00:00 2001
From: Nayujin <00nyj@sookmyung.ac.kr>
Date: Fri, 27 Oct 2023 19:12:29 +0900
Subject: [PATCH 1/9] =?UTF-8?q?init:=201=EC=A3=BC=EC=B0=A8=20=EA=B3=BC?=
=?UTF-8?q?=EC=A0=9C=20=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
assignment/week02/assign2/index.html | 116 +++++++++++++++++++
assignment/week02/assign2/style.css | 160 +++++++++++++++++++++++++++
2 files changed, 276 insertions(+)
create mode 100644 assignment/week02/assign2/index.html
create mode 100644 assignment/week02/assign2/style.css
diff --git a/assignment/week02/assign2/index.html b/assignment/week02/assign2/index.html
new file mode 100644
index 0000000..feee9ae
--- /dev/null
+++ b/assignment/week02/assign2/index.html
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+ 가계부
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
식비
+
+ 따띠삼겹 숙대점
+
+
-8200
+
x
+
+
+
+
식비
+
+ 아름다운가게 성남중동점
+
+
-8200
+
x
+
+
+
+
식비
+
+ 아름다운가게 성남중동점
+
+
-8200
+
x
+
+
+
+
기타
+
+ 9월 캐시백
+
+
+30
+
x
+
+
+
+
식비
+
+ 스타벅스
+
+
-8200
+
x
+
+
+
+
월급
+
+ 9월 알바비
+
+
+300000
+
x
+
+
+
+
식비
+
+ 아름다운가게 성남중동점
+
+
-8200
+
x
+
+
+
+
식비
+
+ 아름다운가게 성남중동점
+
+
-8200
+
x
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/assignment/week02/assign2/style.css b/assignment/week02/assign2/style.css
new file mode 100644
index 0000000..90ce7c6
--- /dev/null
+++ b/assignment/week02/assign2/style.css
@@ -0,0 +1,160 @@
+body {
+ box-sizing: border-box;
+ margin:auto;
+ font-weight: 600;
+}
+
+body > header{
+ text-align: center;
+ font-size: 1.5rem;
+ background-color: lightcyan;
+ border-bottom: 3px solid lightgrey;
+ padding: 1rem 0;
+}
+
+#total{
+ background-color: lightcyan;
+ margin: 10px 30px;
+ border: 5px solid black;
+ border-radius: 10px;
+ padding: 5px 10px;
+ text-align: center;
+ font-size: 15px;
+}
+
+#total strong{
+ font-size: 30px;
+}
+
+#plusminus{
+ display: flex;
+ justify-content: center;
+ margin: 10px 15px;
+}
+
+#plusminus span{
+ background-color: white;
+ text-align: center;
+ border-radius: 100%;
+ padding: 0 5px;
+ margin:10px;
+}
+
+#plusminus div:nth-child(1){
+ color: blue;
+ margin-right: 20px;
+}
+
+#plusminus div:nth-child(2){
+ color: red;
+}
+
+#detail{
+ margin-top: 1rem;
+ margin-bottom: 5px;
+ border-top: 3px solid lightgray;
+ border-bottom: 2px solid lightgray;
+}
+
+#date{
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ margin: 10px 0;
+}
+
+#date img{
+ width: 30px;
+ margin:0 5px;
+}
+
+#datebelow{
+ display: flex;
+ justify-content: space-between;
+ margin:0 20px;
+ padding:0 0 15px;
+}
+
+input[type="checkbox"]{
+ display: none;
+}
+
+input[type="checkbox"]+label{
+ padding:3px 10px;
+ border-radius: 10px;
+ border: 3px solid lightskyblue;
+}
+
+input[type="checkbox"]:checked + label{
+ color: white;
+ background-color: lightskyblue;
+}
+
+#detaillist{
+ display: flex;
+ flex-direction: column;
+ overflow-y: auto;
+ height: 40vh;
+}
+
+#eachlist{
+ display: flex;
+ background-color: lightcyan;
+ margin: 5px 30px;
+ padding: 15px 30px;
+ border-radius: 10px;
+ text-align: left;
+ position: relative;
+}
+
+#eachlist #in{
+ color: blue;
+}
+
+#eachlist #out{
+ color: red;
+}
+
+#eachlist div:nth-child(1){
+ flex-basis: 15%;
+}
+
+#eachlist div:nth-child(2){
+ flex-basis: 60%;
+ display: block;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
+#eachlist div:nth-child(3){
+ flex-basis: 25%;
+ text-align: right;
+}
+
+
+#xbtn{
+ position: absolute;
+ top:0px;
+ right: 8px;
+ font-weight: 500;
+}
+
+#bottom{
+ position: fixed;
+ width: 100%;
+ bottom: 0;
+ background-color: ivory;
+}
+
+#bottom div{
+ background-color: lightsteelblue;
+ width: fit-content;
+ padding: 0px 30px 10px;
+ border-radius: 30px;
+ justify-content: center;
+ vertical-align: center;
+ margin: auto;
+ color: white;
+ font-size: 50px;
+}
\ No newline at end of file
From bc9e36bd5df2b724619137dbd51a7a550f223b53 Mon Sep 17 00:00:00 2001
From: Nayujin <00nyj@sookmyung.ac.kr>
Date: Fri, 27 Oct 2023 19:49:29 +0900
Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=EC=B5=9C=EC=B4=88=20=EB=8D=B0?=
=?UTF-8?q?=EC=9D=B4=ED=84=B0,=20=EC=B4=9D=EC=88=98=EC=9E=85=20=EC=B4=9D?=
=?UTF-8?q?=EC=A7=80=EC=B6=9C=20=EB=B0=98=EC=98=81=ED=95=98=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
assignment/week02/assign2/index.html | 78 ++--------------------------
assignment/week02/assign2/index.js | 63 ++++++++++++++++++++++
assignment/week02/assign2/style.css | 16 +++---
3 files changed, 74 insertions(+), 83 deletions(-)
create mode 100644 assignment/week02/assign2/index.js
diff --git a/assignment/week02/assign2/index.html b/assignment/week02/assign2/index.html
index feee9ae..99af31f 100644
--- a/assignment/week02/assign2/index.html
+++ b/assignment/week02/assign2/index.html
@@ -10,10 +10,10 @@
- 249700
+ 249700
-
+300000
-
-50300
+
+300000
+
-300000
@@ -35,78 +35,6 @@
-
-
식비
-
- 따띠삼겹 숙대점
-
-
-8200
-
x
-
-
-
-
식비
-
- 아름다운가게 성남중동점
-
-
-8200
-
x
-
-
-
-
식비
-
- 아름다운가게 성남중동점
-
-
-8200
-
x
-
-
-
-
기타
-
- 9월 캐시백
-
-
+30
-
x
-
-
-
-
식비
-
- 스타벅스
-
-
-8200
-
x
-
-
-
-
월급
-
- 9월 알바비
-
-
+300000
-
x
-
-
-
-
식비
-
- 아름다운가게 성남중동점
-
-
-8200
-
x
-
-
-
-
식비
-
- 아름다운가게 성남중동점
-
-
-8200
-
x
-
-
+
diff --git a/assignment/week02/assign2/index.js b/assignment/week02/assign2/index.js
new file mode 100644
index 0000000..cf3563b
--- /dev/null
+++ b/assignment/week02/assign2/index.js
@@ -0,0 +1,63 @@
+let init_balance=0;
+let income_total=0;
+let outcome_total=0;
+let history_list=[
+ {
+ category:"과외비",
+ detail:"10월 월급",
+ amount: 500000
+ },{
+ category:"식비",
+ detail:"서브웨이",
+ amount:-30000
+ },{
+ category:"용돈",
+ detail:"10월 용돈",
+ amount:100000
+ },{
+ category:"식비",
+ detail:"수육국밥",
+ amount:-10000
+ }];
+
+const total=document.querySelector("#totalMoney");
+const detaillist=document.querySelector("#detaillist");
+const income=document.querySelector("#income_tot");
+const outcome=document.querySelector("#outcome_tot");
+
+history_list.forEach((each)=>{
+ init_balance+=each.amount;
+
+ const eachlist = document.createElement('div');
+ const category = document.createElement('div');
+ const detail = document.createElement('div');
+ const amount = document.createElement('div');
+ const xbtn = document.createElement('div');
+
+ category.innerText=each.category;
+ detail.innerText=each.detail;
+ amount.innerText=each.amount;
+ xbtn.innerText='x';
+
+ eachlist.appendChild(category);
+ eachlist.appendChild(detail);
+ eachlist.appendChild(amount);
+ eachlist.appendChild(xbtn);
+
+ eachlist.classList.add('eachlist');
+ detaillist.appendChild(eachlist);
+
+ if(each.amount<0){
+ amount.classList.add('out');
+ outcome_total+=each.amount;
+ }else{
+ amount.classList.add('in')
+ income_total+=each.amount;
+ }
+
+ xbtn.classList.add('xbtn');
+})
+
+total.innerText=init_balance;
+income.innerText=income_total;
+outcome.innerText=outcome_total;
\ No newline at end of file
diff --git a/assignment/week02/assign2/style.css b/assignment/week02/assign2/style.css
index 90ce7c6..e3cfb81 100644
--- a/assignment/week02/assign2/style.css
+++ b/assignment/week02/assign2/style.css
@@ -32,7 +32,7 @@ body > header{
margin: 10px 15px;
}
-#plusminus span{
+#plusminus .sign{
background-color: white;
text-align: center;
border-radius: 100%;
@@ -97,7 +97,7 @@ input[type="checkbox"]:checked + label{
height: 40vh;
}
-#eachlist{
+.eachlist{
display: flex;
background-color: lightcyan;
margin: 5px 30px;
@@ -107,19 +107,19 @@ input[type="checkbox"]:checked + label{
position: relative;
}
-#eachlist #in{
+.eachlist .in{
color: blue;
}
-#eachlist #out{
+.eachlist .out{
color: red;
}
-#eachlist div:nth-child(1){
+.eachlist div:nth-child(1){
flex-basis: 15%;
}
-#eachlist div:nth-child(2){
+.eachlist div:nth-child(2){
flex-basis: 60%;
display: block;
overflow: hidden;
@@ -127,13 +127,13 @@ input[type="checkbox"]:checked + label{
text-overflow: ellipsis;
}
-#eachlist div:nth-child(3){
+.eachlist div:nth-child(3){
flex-basis: 25%;
text-align: right;
}
-#xbtn{
+.xbtn{
position: absolute;
top:0px;
right: 8px;
From 81c28c51ae4197c3ba1f8d2dc726f41e00c67522 Mon Sep 17 00:00:00 2001
From: Nayujin <00nyj@sookmyung.ac.kr>
Date: Fri, 27 Oct 2023 21:23:55 +0900
Subject: [PATCH 3/9] =?UTF-8?q?feat:=20=EC=88=98=EC=9E=85/=EC=A7=80?=
=?UTF-8?q?=EC=B6=9C=20=ED=95=84=ED=84=B0=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
assignment/week02/assign2/index.js | 101 +++++++++++++++++++----------
1 file changed, 68 insertions(+), 33 deletions(-)
diff --git a/assignment/week02/assign2/index.js b/assignment/week02/assign2/index.js
index cf3563b..1dfc9e1 100644
--- a/assignment/week02/assign2/index.js
+++ b/assignment/week02/assign2/index.js
@@ -19,45 +19,80 @@ let history_list=[
detail:"수육국밥",
amount:-10000
}];
+let filteredList=history_list;
+let clickedIncome=true, clickedOutcome=true;
const total=document.querySelector("#totalMoney");
-const detaillist=document.querySelector("#detaillist");
+let detaillist=document.querySelector("#detaillist");
const income=document.querySelector("#income_tot");
const outcome=document.querySelector("#outcome_tot");
+const inBtn=document.querySelector("#in");
+const outBtn=document.querySelector("#out");
-history_list.forEach((each)=>{
- init_balance+=each.amount;
-
- const eachlist = document.createElement('div');
- const category = document.createElement('div');
- const detail = document.createElement('div');
- const amount = document.createElement('div');
- const xbtn = document.createElement('div');
-
- category.innerText=each.category;
- detail.innerText=each.detail;
- amount.innerText=each.amount;
- xbtn.innerText='x';
-
- eachlist.appendChild(category);
- eachlist.appendChild(detail);
- eachlist.appendChild(amount);
- eachlist.appendChild(xbtn);
-
- eachlist.classList.add('eachlist');
- detaillist.appendChild(eachlist);
- if(each.amount<0){
- amount.classList.add('out');
- outcome_total+=each.amount;
- }else{
- amount.classList.add('in')
- income_total+=each.amount;
- }
-
- xbtn.classList.add('xbtn');
-})
+makeHistoryList();
total.innerText=init_balance;
income.innerText=income_total;
-outcome.innerText=outcome_total;
\ No newline at end of file
+outcome.innerText=outcome_total;
+
+inBtn.addEventListener("click",infilter);
+outBtn.addEventListener("click",outfilter);
+
+function infilter(){
+ clickedIncome=(!clickedIncome);
+ doFilter()
+}
+
+function outfilter(){
+ clickedOutcome=(!clickedOutcome);
+ doFilter()
+}
+
+function doFilter(){
+ detaillist.replaceChildren();
+ if(clickedIncome && clickedOutcome)
+ filteredList=history_list;
+ else if(clickedIncome)
+ filteredList=history_list.filter((each)=>each.amount>0);
+ else if(clickedOutcome)
+ filteredList=history_list.filter((each)=>each.amount<0);
+ else
+ filteredList=[];
+
+ makeHistoryList();
+}
+
+function makeHistoryList(){
+ filteredList.forEach((each)=>{
+ init_balance+=each.amount;
+
+ const eachlist = document.createElement('div');
+ const category = document.createElement('div');
+ const detail = document.createElement('div');
+ const amount = document.createElement('div');
+ const xbtn = document.createElement('div');
+
+ category.innerText=each.category;
+ detail.innerText=each.detail;
+ amount.innerText=each.amount;
+ xbtn.innerText='x';
+
+ eachlist.appendChild(category);
+ eachlist.appendChild(detail);
+ eachlist.appendChild(amount);
+ eachlist.appendChild(xbtn);
+
+ eachlist.classList.add('eachlist');
+ detaillist.appendChild(eachlist);
+
+ if(each.amount<0){
+ amount.classList.add('out');
+ outcome_total+=each.amount;
+ }else{
+ amount.classList.add('in')
+ income_total+=each.amount;
+ }
+ xbtn.classList.add('xbtn');
+ })
+}
From 35bf41b609233603d25f535da59f19e913abd8f2 Mon Sep 17 00:00:00 2001
From: Nayujin <00nyj@sookmyung.ac.kr>
Date: Fri, 27 Oct 2023 21:59:18 +0900
Subject: [PATCH 4/9] =?UTF-8?q?feat:=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20?=
=?UTF-8?q?=EC=82=AD=EC=A0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
assignment/week02/assign2/index.js | 43 +++++++++++++++++++-----------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/assignment/week02/assign2/index.js b/assignment/week02/assign2/index.js
index 1dfc9e1..b21b844 100644
--- a/assignment/week02/assign2/index.js
+++ b/assignment/week02/assign2/index.js
@@ -1,6 +1,3 @@
-let init_balance=0;
-let income_total=0;
-let outcome_total=0;
let history_list=[
{
category:"과외비",
@@ -31,10 +28,7 @@ const outBtn=document.querySelector("#out");
makeHistoryList();
-
-total.innerText=init_balance;
-income.innerText=income_total;
-outcome.innerText=outcome_total;
+calculateHistory();
inBtn.addEventListener("click",infilter);
outBtn.addEventListener("click",outfilter);
@@ -65,7 +59,6 @@ function doFilter(){
function makeHistoryList(){
filteredList.forEach((each)=>{
- init_balance+=each.amount;
const eachlist = document.createElement('div');
const category = document.createElement('div');
@@ -86,13 +79,33 @@ function makeHistoryList(){
eachlist.classList.add('eachlist');
detaillist.appendChild(eachlist);
- if(each.amount<0){
- amount.classList.add('out');
- outcome_total+=each.amount;
- }else{
- amount.classList.add('in')
- income_total+=each.amount;
- }
+ each.amount<0 ? amount.classList.add('out') : amount.classList.add('in')
+
xbtn.classList.add('xbtn');
+ xbtn.addEventListener('click', deleteHistory);
+
+
})
}
+
+function deleteHistory(event){
+ detaillist.removeChild(event.target.parentNode);
+ console.log(event.target.previousElementSibling.previousElementSibling.innerText);
+ const idx= history_list.findIndex(each => each.detail ===event.target.previousElementSibling.previousElementSibling.innerText)
+ history_list.splice(idx,1);
+ doFilter()
+ calculateHistory();
+}
+
+function calculateHistory(){
+ let init_balance=0;
+ let income_total=0;
+ let outcome_total=0;
+ history_list.forEach((each)=>{
+ init_balance+=each.amount;
+ each.amount<0 ? outcome_total+=each.amount : income_total+=each.amount;
+ })
+ total.innerText=init_balance;
+ income.innerText=income_total;
+ outcome.innerText=outcome_total;
+}
\ No newline at end of file
From 0b942e57fa54a69035246695df488d77087289c8 Mon Sep 17 00:00:00 2001
From: Nayujin <00nyj@sookmyung.ac.kr>
Date: Fri, 27 Oct 2023 23:40:28 +0900
Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20?=
=?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=AA=A8=EB=8B=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
assignment/week02/assign2/index.html | 41 +++++++++++++++
assignment/week02/assign2/index.js | 74 ++++++++++++++++++++++++++++
assignment/week02/assign2/style.css | 35 +++++++++++++
3 files changed, 150 insertions(+)
diff --git a/assignment/week02/assign2/index.html b/assignment/week02/assign2/index.html
index 99af31f..c0f730f 100644
--- a/assignment/week02/assign2/index.html
+++ b/assignment/week02/assign2/index.html
@@ -39,6 +39,47 @@
+
+
+
+
내역 추가
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+