모달창 기능구현은 할 만 했다.
중요한 건 CSS.....
CSS가 너무 어렵다.
이 CSS를 참고하여 공부하자.
import styled from "styled-components";
export const ModalBackdrop = styled.div`
position: fixed; //핵심. 이걸 지우면 위에 뜨지 않고 그냥 화면에 뜬다.
z-index: 999;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.75);
display: grid; //flex와 차이점을 알아두기.
place-items: center;
`;
export const ModalContainer = styled.div`
/* height: 15rem; */
text-align: center;
/* margin: 120px auto; */
`;
export const ModalView = styled.div`
background-color: white;
width: 300px;
padding: 1rem;
> p.desc {
margin-top: 20px;
}
`;
export const ClickButton = styled.button`
/* 공통 스타일 */
/* display: inline-flex; */
align-items: center;
outline: none;
border: none;
border-radius: 4px;
color: black;
font-weight: bold;
cursor: pointer;
padding-left: 1rem;
padding-right: 1rem;
/* 크기 */
height: 2.25rem;
font-size: 1rem;
/* 색상 */
background: #eee;
`;
export const StyledButton = styled.button`
align-items: center;
justify-content: center;
outline: none;
border: none;
background: none;
cursor: pointer;
padding: 0.5rem 1rem;
/* 크기 */
font-size: 2rem;
/* 색상 */
color: black;
&:hover {
opacity: 0.75;
}
`;
export const SolidButton = styled.button`
/* 공통 스타일 */
display: inline-flex;
align-items: center;
justify-content: center;
outline: none;
border: none;
background: none;
cursor: pointer;
padding: 0.5rem 1rem;
white-space: nowrap;
/* 크기 */
font-size: 0.85rem;
width: ${(props) => (props.width === "fit" ? "fit-content" : "100%")};
font-size: 1rem;
background-color: black;
border: 2px solid gray;
color: white;
&:hover {
opacity: 0.75;
}
`;