[TIL/React] 2023/05/18
Try 1 todo section에서는 title만 보여주기 상세 페이지에서 subtitle, desc 보여주기 객체 형태로 subtitle과 desc에 대한 state를, useNavigate()를 통해 페이지가 이동될 때 전달함. 기존에 Todo Card에 있던
Try 1
1. todo section에서는 title만 보여주기 2. 상세 페이지에서 subtitle, desc 보여주기

객체 형태로 subtitle과 desc에 대한 state를, useNavigate()를 통해 페이지가 이동될 때 전달함. 기존에 Todo Card에 있던 subtitle과 desc에 대한 코드는 삭제함.


title을 클릭하면 상세 페이지로 이동, subtitle과 desc가 보임. 상단에는, 상세 페이지에서 TodoList로 가는 이동 버튼을 추가함.


Try 2
1. 공통적인 style을 commons 폴더로 가능한 많이 분리해보자!
src/commons/common.js
import { styled } from "styled-components";
export const CommonTemplateBlock = styled.div`
width: 512px;
height: 900px;
background: white;
background: linear-gradient(to bottom, white, ivory);
border-radius: 16px;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.04);
margin: 0 auto;
margin-top: 96px;
margin-bottom: 32px;
display: flex;
flex-direction: column;
overflow-y: auto;
`;
export const CommonTodoCard = styled.div`
border: 3px solid gray;
border-radius: 10px;
margin-bottom: 10px;
margin: 20px;
display: flex;
flex-direction: column;
align-items: center;
padding: 10px;
`;
export const CommonInputBox = styled.input`
margin-bottom: 10px;
width: 250px;
border: 3px solid gray;
border-radius: 5px;
padding: 4px;
`;
export const CommonTodoContent = styled.p`
font-size: 40px;
font-weight: bolder;
color: gray;
display: flex;
flex-direction: column;
align-items: center;
`;
export const CommonSectionTitle = styled.h2`
text-align: center;
color: #20c997;
font-size: 30px;
margin-top: 30px;
font-weight: bolder;
`;
src/commons/button.js
import { styled } from "styled-components";
export const CommonButton = styled.button`
background-color: #20c997;
opacity: 0.8;
color: white;
font-weight: bolder;
border: none;
border-radius: 7px;
padding: 10px;
&:hover {
border: 3px solid gray;
}
cursor: pointer;
`;
export const CommonButtonWrapper = styled.div`
display: flex;
justify-content: center;
column-gap: 5px;
margin-bottom: 5px;
`;
export const CommonNavButton = styled.button`
background-color: #20c997;
opacity: 0.8;
color: white;
font-weight: bolder;
border: none;
border-radius: 10px;
padding: 8px;
margin-top: 0px;
&:hover {
border: 3px solid gray;
}
cursor: pointer;
`;
src/commons/keyframe.js
import { keyframes } from "styled-components";
export const rotate = keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`;
코드 내에서 2회 이상 반복되는 스타일에 대해서 common 파일로 분리함.
Try 3
1. input 태그는 multiline이 제공되지 않음. 그런데 title, subtitle, desc이 반드시 한 줄이라는 법은 없음. 2. textarea 태그에 대해 알아보자 + 적용해보자

기존 input 태그를 textarea 태그로 변경해보자고 단순하게 생각했다. 자연스럽게 CommonInputBox로 접근했다.

textarea 태그에는 마우스로 끌면 박스의 크기가 늘어나고 줄어드는 'resize' 속성이 적용되어 있었다. none으로 설정했다.
변경하면서, edit button이 두 군데 이상에서 눌리면 갑자기 모든 필드의 값이 동일해지는 현상을 발견했다.

id가 일치하지 않는 todo 객체에 대해서는 editMode를 false로 변경하는 기능을 추가했다. 기존에는 그냥 todo를 반환했다.
여러 줄을 입력하는 부분은 구현했는데, 막상 detail page로 가면 줄바꿈이 반영되지 않았다. 일단은 pre 태그라는 것을 적용했다.



More to read
AI&ML 기초
Reference: https://bettermesol.github.io/ml/2019/09/16/ai-ml-dl/AI: 기계가 사람처럼 생각하고 판단하게 만드는 가장 넓은 범주의 기술입니다.ML: 데이터를 학습하여 스스로 규칙을 찾아내는 AI의 한 분야로,
'AI Agent Economy'Novitas : AI Agent가 지갑을 가지는 세상
얼마 전, 미래에셋증권 리서치 리포트(올해는 이더리움이다: 에이전트 시대의 Near Automata)를 접하게 되었습니다. AI Agent를 인간과 함께할 경제 주체로 바라보는 시각에 적잖이 충격을 받았더랬죠.한 가지 짚고 넘어갈 부분이 있습니다. 우리가 흔히 'AI'
'ERC-8004'Novitas: AI 에이전트 경제 주체
Web 4.0을 한 문장으로 정의하면 Sovereign Transact입니다.AI가 인간의 허락 없이 지갑을 소유하고, 결제를 수행하며, 인프라를 통제하는 주권적 경제 주체가 되는 세계입니다. Web 3.0이 블록체인 기반의 탈중앙화를 실현했다면, Web 4.0은 그