Westagram - 1. login page html/css/Js

quokkaยท2021๋…„ 10์›” 19์ผ
0

Project

๋ชฉ๋ก ๋ณด๊ธฐ
1/6
post-thumbnail

๐ŸŒˆ Instagram clone์ฝ”๋”ฉ์„ ํ•ด๋ณด์•˜๋‹ค.

๐Ÿ“Œ ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€์—์„œ ์•„์ด๋””๋ž‘ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๋ชจ๋‘ ์ž…๋ ฅํ•  ๊ฒฝ์šฐ์— ๋กœ๊ทธ์ธ ๋ฒ„ํŠผ ํ™œ์„ฑํ™” ์‹œํ‚ค๊ธฐ

๐Ÿ‘‡ ๋‚ด๊ฐ€ ๊ตฌํ˜„ํ•œ westagram


๐Ÿ’Ž westagram clone์ฝ”๋”ฉ javascript login page code

โœ๏ธ ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ html ์ฝ”๋“œ

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=3.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>westagram</title>
    
    <!-- ์™ธ๋ถ€ ์Šคํƒ€์ผ์‹œํŠธ ์—ฐ๊ฒฐ -->
    <link rel="icon" type="image/png" href="imgs/favicon.png" />
    <link rel="stylesheet" href="common.css">
    <link rel="stylesheet" href="login.css">
    <style type="text/css"></style>
    
    <!-- ์™ธ๋ถ€ ์Šคํฌ๋ฆฝํŠธ ์—ฐ๊ฒฐ -->
    <script src="login.js" defer></script>
    
    <!-- ํฐํŠธ์–ด์ธ -->
    <script src="https://kit.fontawesome.com/684e97b7f2.js" crossorigin="anonymous"></script>

</head>

<!-- body start -->
<body>
    <!-- ๊ฐ์‹ธ์ง„ ํฐ section -->
    <section class="container-wrap">
        <!-- westagram ๊ธ€์ž -->
            <h2 class="login-title">WESTAGRAM</h2>
        <!-- input,button๊ฐ์‹ธ๊ณ  ์žˆ๋Š” form -->
        <form class="input-container">
        <!-- input์„ ๊ฐ์‹ธ๊ณ  ์žˆ๋Š” div -->
        <div class="input-wrap">
            <input id="id" type="text" placeholder="์ „ํ™”๋ฒˆํ˜ธ,์‚ฌ์šฉ์ž์ด๋ฆ„ ๋˜๋Š” ์ด๋ฉ”์ผ">
            <input id="password" type="password" placeholder="๋น„๋ฐ€๋ฒˆํ˜ธ">
        </div>
        <!-- ๋กœ๊ทธ์ธ ๋ฒ„ํŠผ -->
        <button class="btn" type="submit" disabled>
            ๋กœ๊ทธ์ธ
        </button>
        </form>
        <!-- ๋งˆ์ง€๋ง‰ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์žŠ์œผ์…จ๋‚˜์š” div -->
        <div class="last">
            <p><a href="#">๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์žŠ์œผ์…จ๋‚˜์š”?</a></p>
        </div>     
    </section>
</body>
</html>

โœ๏ธ ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ Common.css ์ฝ”๋“œ ๐Ÿ‘‰ css๊ณตํ†ต ํŒŒ์ผ

@import url("https://fonts.googleapis.com/css2?family=Lobster&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: px solid silver;
}

img {
  width: 50px;
}

body {
  font-family: "Roboto", sans-serif;
  font-size: 0.9rem;
  line-height: 1rem;
  color: #999;
  letter-spacing: 0.1px;
}

h1,
h3 {
  font-family: "Oswald", sans-serif;
}

h1 {
  font-size: 4rem;
  line-height: 4rem;
  text-transform: uppercase;
}

h2 {
  font-size: 2.4rem;
  line-height: 2.4rem;
  text-transform: uppercase;
}

h3 {
  font-size: 1.4rem;
  line-height: 1.4rem;
}

h4,
h5 {
  font-family: "Playfair Display", serif;
}

h4 {
  font-size: 1.1rem;
  line-height: 1.1rem;
}

h5 {
  font-size: 0.7rem;
  line-height: 0.7rem;
}

p {
  color: black;
}

a:link {
  color: #666;
  text-decoration: none;
}
a:visited {
  color: #666;
}
a:hover {
  color: red;
}
a:active {
  color: red;
}

button {
  font-size: 0.7rem;
  text-transform: uppercase;
  padding: 10px 30px;
  border: 1px solid #ccc;
  background: white;
  transition: 0.3s;
}
button:hover {
  background: crimson;
  color: white;
  cursor: pointer;
}

โœ๏ธ ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ login.css ์ฝ”๋“œ

@import url('https://fonts.googleapis.com/css2?family=Lobster&display=swap');
h2 {
    font-family: 'Lobster', cursive;
}

.container-wrap {
    width: 700px;
    margin: 3rem auto;
    border: 1px solid rgb(206, 206, 206);
}

.login-title {
    color: #24292f;;
    font-size: 3.5rem;
    font-weight: 400;
    text-align: center;
    line-height: 4rem;
    letter-spacing: -1px;
    margin-top: 3rem;
}

/* input */
.container-wrap > :nth-child(2) {
    width: 500px;
    margin: 4rem auto;
}

input, textarea {
    width: 500px;
    font-size: 18px;
    margin-bottom: 10px;
    border-radius: 4px;
    padding: 20px 12px;
    border: 1px solid silver;
    background-color: rgba(240, 239, 239, 0.562);
    color: rgba(196, 196, 196, 0.562);
}

input:focus {
    outline: 1px solid rgb(130, 167, 235);
}

.btn {
    width: 500px;
    border-radius: 8px;
    padding: 16px 12px;
    margin: 1.4rem auto;
    font-size: 22px;
    color: white;
    font-weight: bolder;
    background-color: #0098f63d;
    border: none;
}

.btn:hover {
    background-color: #0096F6;
}

.last {
    font-size: 20px;
    text-align: center;
    margin-bottom: 3rem;
    margin-top: 12rem;
    
}

.last p a {
    color: #0e527cfd;
    font-weight: bolder;
}

โœ๏ธ ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ login.js ์ฝ”๋“œ

"use strict";

const inputId = document.querySelector('#id');
const inputPassword = document.querySelector('#password');
const button = document.querySelector('.btn');

function loginBtn(){
    let idValu = inputId.value;
    let passwordValue = inputPassword.value;

    if(idValu.length > 0 && passwordValue.length > 0) {
        button.disabled = false;
        button.style.cursor = 'pointer';
        button.style.backgroundColor = '#1c7ed6';
    }else {
        button.disabled = true;
        button.style.cursor = 'default';
        button.style.backgroundColor = '#bfdffd';
    }
};

inputId.addEventListener('keyup', loginBtn);
inputPassword.addEventListener('keyup', loginBtn);

โœ… ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋ฅผ ์ฝ”๋”ฉํ•˜๊ณ  ๋‚˜์„œ์˜ ํšŒ๊ณ 
๐Ÿ‘‰ ๋‹จ์ˆœํ•˜๊ฒŒ css์†์„ฑ์œผ๋กœ ๋งˆ์šฐ์Šค๋ฅผ ๊ฐ€์ ธ๋‹ค๋Œ€์—ˆ์„๋•Œ ํ˜ธ๋ฒ„๋กœ ๋กœ๊ทธ์ธ ๋ฒ„ํŠผ ์ƒ‰์ƒ์„ ๋ณ€ํ•˜๊ฒŒ ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ javascript์—์„œ ์กฐ๊ฑด์„ ๋งŒ์กฑํ•  ๊ฒฝ์šฐ์— disabled์†์„ฑ์„ ๋น„ํ™œ์„ฑํ™” ์‹œ์ผœ์„œ ๋ฒ„ํŠผ์˜ ์ƒ‰์„ ํ™œ์„ฑํ™” ์‹œํ‚ค๋Š” ๋กœ์ง์„ ๊ตฌํ˜„ํ•ด๋ณด์•˜๋‹ค.

profile
๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป ๋งค์ผ๋งค์ผ์ด ๊ธฐ๋Œ€๋˜๋Š” ๊ฐœ๋ฐœ์ž ^^

0๊ฐœ์˜ ๋Œ“๊ธ€