버전에 맞춰서 강의와 다른 코드가 있습니다.

강의와 별개로 추가한 내용입니다.

 

결과 화면

 


scss를 사용하기 위해 터미널에서 yarn add node-sass 또는 npm install node-sass 명령어를 실행한다.

 

파일 구조

  • src/scss/layout/_layout.scss
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700&display=swap');

body {
    background-color: burlywood;
    font-family: 'Noto Sans', 'Noto Sans KR', sans-serif;

    .layout {
        position: relative;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        max-width: 500px;
        width: 90%;
        margin: 50px auto;
        padding: 30px;
        background-color: bisque;

        button {
            min-height: 30px;
            padding: 0 10px;
            background-color: #fff;
        }
    }
}

 

  • src/routes/home.scss
.home {
    h1 {
        margin-bottom: 30px;
        text-align: center;
    }

    form {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 10px;

        input {
            width: 100%;
            height: 30px;
            padding: 10px;
        }
    }
}

 

  • src/components/todo.scss
ul {
    li {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;

        &:last-child {
            margin-bottom: 0;
        }
    }
}

 

  • src/routes/detail.scss
.detail {
    h1 {
        margin-bottom: 30px;
        text-align: center;
    }

    .date {
        margin-bottom: 10px;
        text-align: right;
    }
}

+ Recent posts